class LogStash::Inputs::BeatsSupport::SynchronousQueueWithOffer
def initialize(timeout, fairness_policy = true)
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
def offer(element, timeout = nil)
If the timeout is reached and it wasn't inserted successfully to
This method will return true if it successfully added the element to the queue.
def offer(element, timeout = nil) @queue.offer(element, timeout || @timeout, java.util.concurrent.TimeUnit::SECONDS) end
def take
def take @queue.take end