Class: Hystrix::CommandExecutorPools
- Inherits:
-
Object
- Object
- Hystrix::CommandExecutorPools
- Includes:
- Singleton
- Defined in:
- lib/hystrix/executor_pool.rb
Instance Attribute Summary collapse
-
#lock ⇒ Object
Returns the value of attribute lock.
-
#pools ⇒ Object
Returns the value of attribute pools.
Instance Method Summary collapse
- #get_pool(pool_name, size = nil) ⇒ Object
-
#initialize ⇒ CommandExecutorPools
constructor
A new instance of CommandExecutorPools.
- #shutdown ⇒ Object
Constructor Details
#initialize ⇒ CommandExecutorPools
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
#lock ⇒ Object
Returns the value of attribute lock.
7 8 9 |
# File 'lib/hystrix/executor_pool.rb', line 7 def lock @lock end |
#pools ⇒ Object
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 |
#shutdown ⇒ Object
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 |