module ActionSubscriber::ThreadPools
Constants
- MUTEX
- THREADPOOL_DEFAULTS
Public Class Methods
setup_threadpool(name, settings)
click to toggle source
# File lib/action_subscriber/thread_pools.rb, line 19 def self.setup_threadpool(name, settings) MUTEX.synchronize do @threadpools ||= {} fail ArgumentError, "a #{name} threadpool already exists" if @threadpools.has_key?(name) @threadpools[name] = create_threadpool(settings) end end
threadpools()
click to toggle source
# File lib/action_subscriber/thread_pools.rb, line 13 def self.threadpools MUTEX.synchronize do @threadpools ||= {} end end
Private Class Methods
create_threadpool(settings)
click to toggle source
# File lib/action_subscriber/thread_pools.rb, line 27 def self.create_threadpool(settings) settings = THREADPOOL_DEFAULTS.merge(settings) num_threads = settings.delete(:threadpool_size) || ::ActionSubscriber.configuration.threadpool_size ::Concurrent::FixedThreadPool.new(num_threads, settings) end