Class: Temporalio::Worker::WorkflowExecutor::ThreadPool
- Inherits:
-
Temporalio::Worker::WorkflowExecutor
- Object
- Temporalio::Worker::WorkflowExecutor
- Temporalio::Worker::WorkflowExecutor::ThreadPool
- Defined in:
- lib/temporalio/worker/workflow_executor/thread_pool.rb
Overview
Thread pool implementation of Temporalio::Worker::WorkflowExecutor.
Users should use ThreadPool.default unless they have specific needs to change the thread pool or max threads.
Defined Under Namespace
Classes: DeadlockError
Class Method Summary collapse
-
.default ⇒ ThreadPool
Default executor that lazily constructs an instance with default values.
Instance Method Summary collapse
-
#initialize(max_threads: [4, Etc.nprocessors].max, thread_pool: Temporalio::Worker::ThreadPool.default) ⇒ ThreadPool
constructor
Create a thread pool executor.
Constructor Details
#initialize(max_threads: [4, Etc.nprocessors].max, thread_pool: Temporalio::Worker::ThreadPool.default) ⇒ ThreadPool
Create a thread pool executor. Most users may prefer default.
30 31 32 33 34 35 36 |
# File 'lib/temporalio/worker/workflow_executor/thread_pool.rb', line 30 def initialize(max_threads: [4, Etc.nprocessors].max, thread_pool: Temporalio::Worker::ThreadPool.default) # rubocop:disable Lint/MissingSuper @max_threads = max_threads @thread_pool = thread_pool @workers_mutex = Mutex.new @workers = [] @workers_by_worker_state_and_run_id = {} end |
Class Method Details
.default ⇒ ThreadPool
Returns Default executor that lazily constructs an instance with default values.
22 23 24 |
# File 'lib/temporalio/worker/workflow_executor/thread_pool.rb', line 22 def self.default @default ||= ThreadPool.new end |