Method: MarchHare::ThreadPools.fixed_of_size

Defined in:
lib/march_hare/thread_pools.rb

.fixed_of_size(n) ⇒ Object

Returns a new thread pool (JDK executor) of a fixed size.

Returns:

  • A thread pool (JDK executor)

Raises:

  • (ArgumentError)


10
11
12
13
14
15
# File 'lib/march_hare/thread_pools.rb', line 10

def self.fixed_of_size(n)
  raise ArgumentError.new("n must be a positive integer!") unless Integer === n
  raise ArgumentError.new("n must be a positive integer!") unless n > 0

  JavaConcurrent::Executors.new_fixed_thread_pool(n)
end