class LogStash::Inputs::BeatsSupport::SynchronousQueueWithOffer
Public Class Methods
new(timeout, fairness_policy = true)
click to toggle source
# File lib/logstash/inputs/beats_support/synchronous_queue_with_offer.rb, line 13 def initialize(timeout, fairness_policy = true) # set Fairness policy to `FIFO` # # In the context of the input it makes sense to # try to deal with the older connection before # the newer one, since the older will be closer to # reach the connection timeout. # @timeout = timeout @queue = java.util.concurrent.SynchronousQueue.new(fairness_policy) end
Public Instance Methods
offer(element, timeout = nil)
click to toggle source
This method will return true if it successfully added the element to the queue. If the timeout is reached and it wasn't inserted successfully to the queue it will return false.
# File lib/logstash/inputs/beats_support/synchronous_queue_with_offer.rb, line 28 def offer(element, timeout = nil) @queue.offer(element, timeout || @timeout, java.util.concurrent.TimeUnit::SECONDS) end
take()
click to toggle source
# File lib/logstash/inputs/beats_support/synchronous_queue_with_offer.rb, line 32 def take @queue.take end