Sha256: 4acd826bc6b887ff63d9c64eae2f30bd795347b628b3880bd531cc99d80ffb3c

Contents?: true

Size: 1.13 KB

Versions: 107

Compression:

Stored size: 1.13 KB

Contents

if Concurrent.on_jruby?
  require 'concurrent/utility/native_extension_loader'

  module Concurrent

    # @!macro count_down_latch
    # @!visibility private
    # @!macro internal_implementation_note
    class JavaCountDownLatch

      # @!macro count_down_latch_method_initialize
      def initialize(count = 1)
        Utility::NativeInteger.ensure_integer_and_bounds(count)
        Utility::NativeInteger.ensure_positive(count)
        @latch = java.util.concurrent.CountDownLatch.new(count)
      end

      # @!macro count_down_latch_method_wait
      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

      # @!macro count_down_latch_method_count_down
      def count_down
        @latch.countDown
      end

      # @!macro count_down_latch_method_count
      def count
        @latch.getCount
      end
    end
  end
end

Version data entries

107 entries across 106 versions & 18 rubygems

Version Path
harbr-0.1.50 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.49 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.48 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.47 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.46 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.45 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.44 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.43 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.42 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.41 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.39 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.38 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
harbr-0.1.37 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
fablicop-1.10.2 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb