Class: LogStash::Util::WrappedSynchronousQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/util/wrapped_synchronous_queue.rb

Defined Under Namespace

Classes: ReadBatch, ReadClient, WriteBatch, WriteClient

Instance Method Summary collapse

Constructor Details

#initializeWrappedSynchronousQueue

Returns a new instance of WrappedSynchronousQueue.



8
9
10
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 8

def initialize
  @queue = java.util.concurrent.SynchronousQueue.new
end

Instance Method Details

#closeObject



34
35
36
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 34

def close
  # ignore
end

#poll(millis) ⇒ Object

Block for X millis



22
23
24
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 22

def poll(millis)
  @queue.poll(millis, TimeUnit::MILLISECONDS)
end

#push(obj) ⇒ Object Also known as: <<

Push an object to the queue if the queue is full it will block until the object can be added to the queue.

Parameters:

  • Object (Object)

    to add to the queue



16
17
18
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 16

def push(obj)
  @queue.put(obj)
end

#read_clientObject



30
31
32
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 30

def read_client
  ReadClient.new(self)
end

#write_clientObject



26
27
28
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 26

def write_client
  WriteClient.new(self)
end