class Concurrent::JavaCountDownLatch
@!macro internal_implementation_note
@!visibility private
@!macro count_down_latch
def count
def count @latch.getCount end
def count_down
def count_down @latch.countDown end
def initialize(count = 1)
def initialize(count = 1) Utility::NativeInteger.ensure_integer_and_bounds(count) Utility::NativeInteger.ensure_positive(count) @latch = java.util.concurrent.CountDownLatch.new(count) end
def wait(timeout = nil)
def wait(timeout = nil) result = nil if timeout.nil? Synchronization::JRuby.sleep_interruptibly { @latch.await } result = true else Synchronization::JRuby.sleep_interruptibly do result = @latch.await(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end result end