T - the event classpublic abstract class EventProcessor<T> extends Object
start() is called.
The thread that calls start() will process all events in the order they
were added until the queue is empty. Other threads will just enqueue their events.| Constructor and Description |
|---|
EventProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
processEvent(T event)
Process a single event.
|
void |
sendEvent(T newEvent)
Send an event to the processor.
|
void |
start()
Start processing events as soon as the queue isn't empty.
If the queue is not empty, this method will process all events already in the queue and any event that will be added while the queue is being processed. |
public void sendEvent(T newEvent)
If an event's processing causes an exception, it will be added to any previous exceptions as a suppressed exception. Once all the currently queued events have been processed, a single exception will be thrown.
newEvent - the new eventRuntimeException - if any exception is thrown while events are being processedpublic void start()
RuntimeException - if any exception is thrown while events are being processedprotected abstract void processEvent(T event)
event - the event to processCopyright © 2021 The Apache Software Foundation. All rights reserved.