Class: Kato::PoolSupervisor
- Inherits:
-
Object
- Object
- Kato::PoolSupervisor
- Defined in:
- lib/kato/pool_supervisor.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#pool_managers ⇒ Object
Returns the value of attribute pool_managers.
Instance Method Summary collapse
-
#initialize(config) ⇒ PoolSupervisor
constructor
A new instance of PoolSupervisor.
- #run ⇒ Object
Constructor Details
#initialize(config) ⇒ PoolSupervisor
Returns a new instance of PoolSupervisor.
5 6 7 8 |
# File 'lib/kato/pool_supervisor.rb', line 5 def initialize(config) @config = config @pool_managers = [] end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/kato/pool_supervisor.rb', line 3 def config @config end |
#pool_managers ⇒ Object
Returns the value of attribute pool_managers.
3 4 5 |
# File 'lib/kato/pool_supervisor.rb', line 3 def pool_managers @pool_managers end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kato/pool_supervisor.rb', line 10 def run threads = [] config[:service_pools].each do |service_pool| threads << Thread.new(service_pool) do |pool_config| pool_manager = PoolManager.new(pool_config, config[:aws]) @pool_managers << pool_manager pool_manager.run end threads.each { |thread| thread.join } end end |