class Bio::MAF::JExecutor
Public Class Methods
new()
click to toggle source
# File lib/bio/maf/jobs.rb, line 119 def initialize queue = java.util.concurrent.LinkedBlockingQueue.new(8) policy = java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy.new @exec = java.util.concurrent.ThreadPoolExecutor.new(1, 1, 1, java.util.concurrent.TimeUnit::MINUTES, queue, policy) @ecs = java.util.concurrent.ExecutorCompletionService.new(@exec) @submitted = 0 @completed = 0 end
Public Instance Methods
check_for_errors()
click to toggle source
# File lib/bio/maf/jobs.rb, line 137 def check_for_errors while f = @ecs.poll f.get @completed += 1 end end
shutdown()
click to toggle source
# File lib/bio/maf/jobs.rb, line 144 def shutdown @exec.shutdown until @completed == @submitted f = @ecs.take f.get @completed += 1 end end
submit(&blk)
click to toggle source
# File lib/bio/maf/jobs.rb, line 131 def submit(&blk) @ecs.submit(&blk) @submitted += 1 check_for_errors end