Sha256: d899e45cdd1b25a8b939aa02331a013e27202b61755c2a32a29624e0fb31e860

Contents?: true

Size: 872 Bytes

Versions: 39

Compression:

Stored size: 872 Bytes

Contents

# Remove this in Logstash 6.0
module LogStash module OutputDelegatorStrategies class Legacy
  attr_reader :worker_count, :workers
  
  def initialize(logger, klass, metric, plugin_args)
    @worker_count = (plugin_args["workers"] || 1).to_i
    @workers = @worker_count.times.map { klass.new(plugin_args) }
    @workers.each {|w| w.metric = metric }
    @worker_queue = SizedQueue.new(@worker_count)
    @workers.each {|w| @worker_queue << w}
  end
  
  def register
    @workers.each(&:register)
  end
  
  def multi_receive(events)
    worker = @worker_queue.pop
    worker.multi_receive(events)
  ensure
    @worker_queue << worker if worker
  end

  def do_close
    # No mutex needed since this is only called when the pipeline is clear
    @workers.each(&:do_close)
  end

  ::LogStash::OutputDelegatorStrategyRegistry.instance.register(:legacy, self)
end; end; end

Version data entries

39 entries across 38 versions & 9 rubygems

Version Path
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.2.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.2.1-java/lib/logstash/output_delegator_strategies/legacy.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/logstash-core-5.0.0-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/logstash-core-5.2.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/logstash-core-5.2.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-filter-csharp-0.1.0 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.2.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.3.3-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/logstash-core-5.2.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.3.2-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.3.1-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.3.0-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.2.2-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/logstash-core-5.1.1.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/logstash-core-5.1.1.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.2.1-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.2.0-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/logstash-core-5.1.1.1-java/lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.1.2-java lib/logstash/output_delegator_strategies/legacy.rb
logstash-core-5.1.1.1-java lib/logstash/output_delegator_strategies/legacy.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/logstash-core-5.1.2.snapshot1-java/lib/logstash/output_delegator_strategies/legacy.rb