Class: Hystrix::CommandExecutorPools

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/hystrix/executor_pool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommandExecutorPools

Returns a new instance of CommandExecutorPools.



9
10
11
12
# File 'lib/hystrix/executor_pool.rb', line 9

def initialize
	self.lock = Mutex.new
	self.pools = {}
end

Instance Attribute Details

#lockObject

Returns the value of attribute lock.



7
8
9
# File 'lib/hystrix/executor_pool.rb', line 7

def lock
  @lock
end

#poolsObject

Returns the value of attribute pools.



7
8
9
# File 'lib/hystrix/executor_pool.rb', line 7

def pools
  @pools
end

Instance Method Details

#get_pool(pool_name, size = nil) ⇒ Object



14
15
16
17
18
# File 'lib/hystrix/executor_pool.rb', line 14

def get_pool(pool_name, size = nil)
	lock.synchronize do
		pools[pool_name] ||= CommandExecutorPool.new(pool_name, size || 10)
	end
end

#shutdownObject



20
21
22
23
24
25
26
# File 'lib/hystrix/executor_pool.rb', line 20

def shutdown
	lock.synchronize do
		for pool_name, pool in pools
			pool.shutdown
		end
	end
end