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.
-
#offer(obj, timeout_ms) ⇒ Boolean
Offer an object to the queue, wait for the specified amout of time.
-
#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
-
#take ⇒ Object
Blocking.
- #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
49 50 51 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 49 def close # ignore end |
#offer(obj, timeout_ms) ⇒ Boolean
Offer an object to the queue, wait for the specified amout of time. If adding to the queue was successfull it wil return true, false otherwise.
27 28 29 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 27 def offer(obj, timeout_ms) @queue.offer(obj, timeout_ms, TimeUnit::MILLISECONDS) end |
#poll(millis) ⇒ Object
Block for X millis
37 38 39 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 37 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
45 46 47 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 45 def read_client ReadClient.new(self) end |
#take ⇒ Object
Blocking
32 33 34 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 32 def take @queue.take end |
#write_client ⇒ Object
41 42 43 |
# File 'lib/logstash/util/wrapped_synchronous_queue.rb', line 41 def write_client WriteClient.new(self) end |