Class TimeoutBlockingWaitStrategy
java.lang.Object
org.apache.logging.log4j.async.logger.internal.TimeoutBlockingWaitStrategy
- All Implemented Interfaces:
com.lmax.disruptor.WaitStrategy
Blocking strategy that uses a lock and condition variable for
EventProcessor
s waiting on a barrier.
However, it will periodically wake up if it has been idle for specified period by throwing a
TimeoutException
. To make use of this, the event handler class should override
EventHandlerBase.onTimeout(long)
, which the BatchEventProcessor
will call if the timeout occurs.
This strategy can be used when throughput and low-latency are not as important as CPU resource.
-
Constructor Details
-
TimeoutBlockingWaitStrategy
- Parameters:
timeout
- how long to wait before waking upunits
- the unit in which timeout is specified
-
-
Method Details
-
waitFor
public long waitFor(long sequence, com.lmax.disruptor.Sequence cursorSequence, com.lmax.disruptor.Sequence dependentSequence, com.lmax.disruptor.SequenceBarrier barrier) throws com.lmax.disruptor.AlertException, InterruptedException, com.lmax.disruptor.TimeoutException - Specified by:
waitFor
in interfacecom.lmax.disruptor.WaitStrategy
- Throws:
com.lmax.disruptor.AlertException
InterruptedException
com.lmax.disruptor.TimeoutException
-
signalAllWhenBlocking
public void signalAllWhenBlocking()- Specified by:
signalAllWhenBlocking
in interfacecom.lmax.disruptor.WaitStrategy
-
toString
-