Sha256: dd656bac4df74c14f1f552443444416081a96b6cbd9affa93e8da66942b606b7
Contents?: true
Size: 970 Bytes
Versions: 2
Compression:
Stored size: 970 Bytes
Contents
module HotBunnies import java.util.concurrent.Executors # A slighly more Ruby developer-friendly way of instantiating various # JDK executors (thread pools). class ThreadPools # Returns a new thread pool (JDK executor) of a fixed size. # # @return A thread pool (JDK executor) 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 Executors.new_fixed_thread_pool(n) end # Returns a new thread pool (JDK executor) of a fixed size of 1. # # @return A thread pool (JDK executor) def self.single_threaded Executors.new_single_thread_executor end # Returns a new thread pool (JDK executor) that will create new # threads as needed. # # @return A thread pool (JDK executor) def self.dynamically_growing Executors.new_cached_thread_pool end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hot_bunnies-2.0.0.pre10-java | lib/hot_bunnies/thread_pools.rb |
hot_bunnies-2.0.0.pre9-java | lib/hot_bunnies/thread_pools.rb |