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 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 the
Executor
passed to the Disruptor
constructor.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final int
private com.lmax.disruptor.Sequence
private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the thread ID of the background consumer thread, or-1
if the background thread has not started yet.private void
notifyCallback
(long sequence) void
onEvent
(RingBufferLogEvent event, long sequence, boolean endOfBatch) void
void
onStart()
void
setSequenceCallback
(com.lmax.disruptor.Sequence sequenceCallback)
-
Field Details
-
NOTIFY_PROGRESS_THRESHOLD
private static final int NOTIFY_PROGRESS_THRESHOLD- See Also:
-
sequenceCallback
private com.lmax.disruptor.Sequence sequenceCallback -
counter
private int counter -
threadId
private long threadId
-
-
Constructor Details
-
RingBufferLogEventHandler
public RingBufferLogEventHandler()
-
-
Method Details
-
setSequenceCallback
public void setSequenceCallback(com.lmax.disruptor.Sequence sequenceCallback) - Specified by:
setSequenceCallback
in interfacecom.lmax.disruptor.SequenceReportingEventHandler<RingBufferLogEvent>
-
onEvent
- Specified by:
onEvent
in interfacecom.lmax.disruptor.EventHandler<RingBufferLogEvent>
- Throws:
Exception
-
notifyCallback
private void notifyCallback(long sequence) -
getThreadId
public long getThreadId()Returns the thread ID of the background consumer thread, or-1
if the background thread has not started yet.- Returns:
- the thread ID of the background consumer thread, or
-1
-
onStart
public void onStart()- Specified by:
onStart
in interfacecom.lmax.disruptor.LifecycleAware
-
onShutdown
public void onShutdown()- Specified by:
onShutdown
in interfacecom.lmax.disruptor.LifecycleAware
-