Sha256: 274f179af43db84861c5696e0d374aa32ecfbd8ba8958707809f8f33dd0ab0f8

Contents?: true

Size: 1.32 KB

Versions: 35

Compression:

Stored size: 1.32 KB

Contents

# This file has circular require issues. It must be autoloaded.

require 'concurrent/configuration'

module Concurrent

  # @!visibility private
  module Options

    # Get the requested `Executor` based on the values set in the options hash.
    #
    # @param [Hash] opts the options defining the requested executor
    # @option opts [Executor] :executor when set use the given `Executor` instance.
    #   Three special values are also supported: `:fast` returns the global fast executor,
    #   `:io` returns the global io executor, and `:immediate` returns a new
    #   `ImmediateExecutor` object.
    #
    # @return [Executor, nil] the requested thread pool, or nil when no option specified
    #
    # @!visibility private
    def self.executor_from_options(opts = {}) # :nodoc:
      if identifier = opts.fetch(:executor, nil)
        executor(identifier)
      else
        nil
      end
    end

    def self.executor(executor_identifier)
      case executor_identifier
      when :fast
        Concurrent.global_fast_executor
      when :io
        Concurrent.global_io_executor
      when :immediate
        Concurrent.global_immediate_executor
      when Concurrent::ExecutorService
        executor_identifier
      else
        raise ArgumentError, "executor not recognized by '#{executor_identifier}'"
      end
    end
  end
end

Version data entries

35 entries across 33 versions & 12 rubygems

Version Path
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-csharp-0.1.0 vendor/bundle/jruby/2.3.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-htmlentities-0.1.0 vendor/bundle/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-delta-1.1.0 vendor/bundle/jruby/2.2.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-delta-1.0.1 vendor/bundle/jruby/2.2.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-base64-1.0.4 vendor/bundle/jruby/2.2.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-base64-1.0.3 vendor/bundle/jruby/2.2.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb
logstash-filter-delta-1.0.0 vendor/bundle/jruby/2.2.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/options.rb