Class: LogStash::Util::WrappedSynchronousQueue
- Inherits:
-
Object
- Object
- LogStash::Util::WrappedSynchronousQueue
- Defined in:
- lib/logstash/util/wrapped_synchronous_queue.rb
Defined Under Namespace
Classes: ReadBatch, ReadClient, WriteBatch, WriteClient
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ WrappedSynchronousQueue
constructor
A new instance of WrappedSynchronousQueue.
-
#poll(millis) ⇒ Object
Block for X millis.
-
#push(obj) ⇒ Object
(also: #<<)
Push an object to the queue if the queue is full it will block until the object can be added to the queue.
- #read_client ⇒ Object
- #write_client ⇒ Object
Constructor Details
#initialize ⇒ WrappedSynchronousQueue
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
#close ⇒ Object
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.
16 17 18 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 16 def push(obj) @queue.put(obj) end |
#read_client ⇒ Object
30 31 32 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 30 def read_client ReadClient.new(self) end |
#write_client ⇒ Object
26 27 28 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 26 def write_client WriteClient.new(self) end |