Module: Contender

Defined in:
lib/contender.rb,
lib/contender/queue.rb,
lib/contender/errors.rb,
lib/contender/future.rb,
lib/contender/counter.rb,
lib/contender/version.rb,
lib/contender/executor.rb,
lib/contender/future_task.rb,
lib/contender/linked_queue.rb,
lib/contender/thread_factory.rb,
lib/contender/countdown_latch.rb,
lib/contender/direct_executor.rb,
lib/contender/executor_service.rb,
lib/contender/pool/pool_worker.rb,
lib/contender/copy_on_write_set.rb,
lib/contender/pool/pool_executor.rb,
lib/contender/copy_on_write_array.rb,
lib/contender/pool/rejection_policy.rb,
lib/contender/copy_on_write_structure.rb

Defined Under Namespace

Modules: CopyOnWriteStructure, Pool Classes: CancellationError, CopyOnWriteArray, CopyOnWriteSet, CountdownLatch, Counter, DirectExecutor, ExecutionError, Executor, ExecutorService, Future, FutureTask, InterruptError, InvalidStateError, LinkedQueue, Queue, SimpleThreadFactory, ThreadFactory, TimeoutError

Constant Summary collapse

FIXNUM_MAX =
(2**(0.size * 8 - 2) - 1)
FIXNUM_MIN =
- 2))
VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.fixed_pool(size, allow_timeout = false) ⇒ PoolExecutor

Parameters:

  • size (Integer)
  • allow_timeout (Boolean) (defaults to: false)

Returns:

  • (PoolExecutor)


34
35
36
37
38
39
40
41
42
43
# File 'lib/contender.rb', line 34

def self.fixed_pool(size, allow_timeout = false)
  executor = Pool::PoolExecutor.new size, size, 0, LinkedQueue.new, simple_thread_factory

  if allow_timeout
    executor.work_timeout = 60
    executor.allow_core_timeout = true
  end

  executor
end

.simple_thread_factoryObject



50
51
52
# File 'lib/contender.rb', line 50

def self.simple_thread_factory
  SimpleThreadFactory.new
end

.single_poolPoolExecutor

Returns:

  • (PoolExecutor)


46
47
48
# File 'lib/contender.rb', line 46

def self.single_pool
  fixed_pool 1
end