Class: Kato::PoolSupervisor

Inherits:
Object
  • Object
show all
Defined in:
lib/kato/pool_supervisor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject

Returns the value of attribute config.



3
4
5
# File 'lib/kato/pool_supervisor.rb', line 3

def config
  @config
end

#pool_managersObject

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

#runObject



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