Module: Concur::Executor

Defined in:
lib/executor.rb

Overview

Decouples task submission from how each task is run. An Executor can be backed by a thread pool or some other mechanism, but how you use the Executor won’t change. This allows you to change the backend implementation with minor code changes.

Inspired by java.util.concurrent.Executor

Defined Under Namespace

Classes: Base

Class Method Summary collapse

Class Method Details

.new_multi_threaded_executor(options = {}) ⇒ Object



39
40
41
42
43
# File 'lib/executor.rb', line 39

def self.new_multi_threaded_executor(options={})
  #executor = Executor.new
  executor = MultiThreaded.new
  executor
end

.new_single_threaded_executor(options = {}) ⇒ Object



33
34
35
36
37
# File 'lib/executor.rb', line 33

def self.new_single_threaded_executor(options={})
  #executor = Executor.new
  executor = SingleThreaded.new
  executor
end

.new_thread_pool_executor(max_size, options = {}) ⇒ Object



45
46
47
48
49
# File 'lib/executor.rb', line 45

def self.new_thread_pool_executor(max_size, options={})
  #executor = Executor.new
  executor = ThreadPool.new(max_size)
  executor
end