public abstract class AbstractLongRunningListener extends Object implements PostCommitFilteringEventListener
PostCommitEventListener
are executed in a
Work
that will take care of starting/comitting the transaction.
If the listener requires a long processing this will create long transactions that are not good. To avoid this
behavior, this base class split the processing in 3 steps :
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
log |
Constructor and Description |
---|
AbstractLongRunningListener() |
Modifier and Type | Method and Description |
---|---|
void |
handleEvent(EventBundle events)
Handles the set of events that were raised during the life of an user operation.
|
protected abstract boolean |
handleEventLongRunning(List<String> eventNames,
Map<String,Object> data)
Will be executed in a non transactional context
Any acess to a CoreSession will generate WARN in the the logs.
|
protected abstract void |
handleEventPostprocessing(EventBundle events,
Map<String,Object> data)
Finish processing in a dedicated Transaction
|
protected abstract boolean |
handleEventPreprocessing(EventBundle events,
Map<String,Object> data)
Handles first step of processing in a normal transactional way.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
acceptEvent
protected static final org.apache.commons.logging.Log log
public AbstractLongRunningListener()
public void handleEvent(EventBundle events)
PostCommitEventListener
The events are fired as a BundleEvent
after the transaction is committed.
handleEvent
in interface PostCommitEventListener
events
- the events to handleprotected abstract boolean handleEventPreprocessing(EventBundle events, Map<String,Object> data)
events
- EventBundle
receiveddata
- an empty map to store data to share data between steps.protected abstract boolean handleEventLongRunning(List<String> eventNames, Map<String,Object> data)
eventNames
- list of event namesdata
- an map that may have been filled by handleEventPreprocessingprotected abstract void handleEventPostprocessing(EventBundle events, Map<String,Object> data)
events
- EventBundle
receiveddata
- an map that may have been filled by handleEventPreprocessing and handleEventLongRunningCopyright © 2018 Nuxeo. All rights reserved.