Sha256: 639d0599e8071097b9405a5c4f112b14fc589d6ac629e8aabca11325a637ab7b

Contents?: true

Size: 990 Bytes

Versions: 38

Compression:

Stored size: 990 Bytes

Contents

# encoding: utf-8
require "logstash/namespace"
require "cabin"

class LogStash::MultiQueue
  attr_accessor :logger

  public
  def initialize(*queues)
    @logger = Cabin::Channel.get(LogStash)
    @mutex = Mutex.new
    @queues = queues
  end # def initialize

  public
  def logger=(_logger)
    @logger = _logger

    # Set the logger for all known queues, too.
    @queues.each do |q|
      q.logger = _logger
    end
  end # def logger=

  # Push an object to all queues.
  public
  def push(object)
    @queues.each { |q| q.push(object) }
  end # def push
  alias :<< :push

  alias_method :<<, :push

  # Add a new Queue to this queue.
  public
  def add_queue(queue)
    @mutex.synchronize do
      @queues << queue
    end
  end # def add_queue

  public
  def remove_queue(queue)
    @mutex.synchronize do
      @queues.delete(queue)
    end
  end # def remove_queue

  public
  def size
    return @queues.collect { |q| q.size }
  end # def size
end # class LogStash::MultiQueue

Version data entries

38 entries across 38 versions & 4 rubygems

Version Path
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/multiqueue.rb
logstash-core-1.5.6-java lib/logstash/multiqueue.rb
logstash-core-1.5.5-java lib/logstash/multiqueue.rb
logstash-input-beats-0.9.2 vendor/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/multiqueue.rb
logstash-input-beats-0.9.1 vendor/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/multiqueue.rb
logstash-core-2.0.0.beta1-java lib/logstash/multiqueue.rb
logstash-core-1.5.4-java lib/logstash/multiqueue.rb
logstash-core-1.5.4.snapshot3-java lib/logstash/multiqueue.rb
logstash-core-1.5.4.snapshot2-java lib/logstash/multiqueue.rb
logstash-core-1.5.4.snapshot1-java lib/logstash/multiqueue.rb
logstash-core-1.5.3-java lib/logstash/multiqueue.rb
logstash-core-1.5.3.snapshot2-java lib/logstash/multiqueue.rb
logstash-core-1.5.3.snapshot1-java lib/logstash/multiqueue.rb
logstash-core-1.5.2.2-java lib/logstash/multiqueue.rb
logstash-core-1.5.2.1-java lib/logstash/multiqueue.rb
logstash-core-1.5.2-java lib/logstash/multiqueue.rb
logstash-core-1.5.2.snapshot2-java lib/logstash/multiqueue.rb
logstash-core-1.5.2.snapshot1-java lib/logstash/multiqueue.rb
logstash-core-1.5.1-java lib/logstash/multiqueue.rb
logstash-core-1.5.1.snapshot1-java lib/logstash/multiqueue.rb