class Concurrent::JavaExecutorService
@!macro abstract_executor_service_public_api @!visibility private
Constants
- FALLBACK_POLICY_CLASSES
Public Instance Methods
Source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 46 def kill synchronize do @executor.shutdownNow nil end end
Source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 21 def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return handle_fallback(*args, &task) unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end
Source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 39 def shutdown synchronize do @executor.shutdown nil end end
Source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 30 def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end
Private Instance Methods
Source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 55 def ns_running? !(ns_shuttingdown? || ns_shutdown?) end
Source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 67 def ns_shutdown? @executor.isShutdown || @executor.isTerminated end
Source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 59 def ns_shuttingdown? if @executor.respond_to? :isTerminating @executor.isTerminating else false end end