Class RingBufferLogEventHandler
- java.lang.Object
-
- org.apache.logging.log4j.core.async.RingBufferLogEventHandler
-
- All Implemented Interfaces:
com.lmax.disruptor.EventHandler<RingBufferLogEvent>,com.lmax.disruptor.LifecycleAware,com.lmax.disruptor.SequenceReportingEventHandler<RingBufferLogEvent>
public class RingBufferLogEventHandler extends java.lang.Object implements com.lmax.disruptor.SequenceReportingEventHandler<RingBufferLogEvent>, com.lmax.disruptor.LifecycleAware
This event handler gets passed messages from the RingBuffer as they become available. Processing of these messages is done in a separate thread, controlled by theExecutorpassed to theDisruptorconstructor.
-
-
Field Summary
Fields Modifier and Type Field Description private intcounterprivate static intNOTIFY_PROGRESS_THRESHOLDprivate com.lmax.disruptor.SequencesequenceCallbackprivate longthreadId
-
Constructor Summary
Constructors Constructor Description RingBufferLogEventHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetThreadId()Returns the thread ID of the background consumer thread, or-1if the background thread has not started yet.private voidnotifyCallback(long sequence)voidonEvent(RingBufferLogEvent event, long sequence, boolean endOfBatch)voidonShutdown()voidonStart()voidsetSequenceCallback(com.lmax.disruptor.Sequence sequenceCallback)
-
-
-
Field Detail
-
NOTIFY_PROGRESS_THRESHOLD
private static final int NOTIFY_PROGRESS_THRESHOLD
- See Also:
- Constant Field Values
-
sequenceCallback
private com.lmax.disruptor.Sequence sequenceCallback
-
counter
private int counter
-
threadId
private long threadId
-
-
Method Detail
-
setSequenceCallback
public void setSequenceCallback(com.lmax.disruptor.Sequence sequenceCallback)
- Specified by:
setSequenceCallbackin interfacecom.lmax.disruptor.SequenceReportingEventHandler<RingBufferLogEvent>
-
onEvent
public void onEvent(RingBufferLogEvent event, long sequence, boolean endOfBatch) throws java.lang.Exception
- Specified by:
onEventin interfacecom.lmax.disruptor.EventHandler<RingBufferLogEvent>- Throws:
java.lang.Exception
-
notifyCallback
private void notifyCallback(long sequence)
-
getThreadId
public long getThreadId()
Returns the thread ID of the background consumer thread, or-1if the background thread has not started yet.- Returns:
- the thread ID of the background consumer thread, or
-1
-
onStart
public void onStart()
- Specified by:
onStartin interfacecom.lmax.disruptor.LifecycleAware
-
onShutdown
public void onShutdown()
- Specified by:
onShutdownin interfacecom.lmax.disruptor.LifecycleAware
-
-