public abstract class AbstractEventProcessor extends Object implements EventProcessor, org.springframework.beans.factory.BeanNameAware
event processor implementations
Read 'good practice' notes for documenting behaviour.| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
DEFAULT_AUTO_CLOSE_SESSION_ID |
protected static boolean |
DEFAULT_AUTO_PROPAGATE_SESSION_ID |
protected static boolean |
DEFAULT_CHART |
protected static long |
DEFAULT_WARN_DELAY |
protected org.apache.commons.logging.Log |
logger
Resource for derived classes to use for logging
|
| Constructor and Description |
|---|
AbstractEventProcessor()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName() |
long |
getWarnDelay()
Provide a hint for the processing framework on how much time should elapse before
the warnings need to be issued over the delay
|
boolean |
isAutoCloseSessionId()
Must the framework auto-close any event sessions that cannot be propagated? This
will be called if there are no further events to publish, either through an exception
coming out of the processing or because an event has no further events in the chain.
|
boolean |
isAutoPropagateSessionId()
Must the framework automatically carry event sessions from event to event.
|
boolean |
isChart()
Hint whether the result should be included in charts
|
protected abstract EventResult |
processEvent(Event event)
Process an event.
|
EventResult |
processEvent(Event event,
org.apache.commons.lang3.time.StopWatch stopWatch)
Process an event.
|
void |
register()
Register this instance for the event names that are handled.
|
protected long |
resumeTimer()
Continue timing the event processing
|
void |
setAutoCloseSessionId(boolean autoCloseSessionId)
Change the
default session ID auto-close
behaviour |
void |
setAutoPropagateSessionId(boolean autoPropagateSessionId)
Change the
default session ID propagation
behaviour |
void |
setBeanName(String beanName) |
void |
setChart(boolean chart) |
void |
setEventName(String eventName)
Set the single event name that this processor can handle
|
void |
setEventNames(List<String> eventNames)
Set the names of the events that this processor can handle
|
void |
setRegistry(EventProcessorRegistry registry)
Inject the registry that this instance will
register with. |
void |
setWarnDelay(long warnDelay) |
protected long |
stopTimer()
Stop timing the event processing.
|
protected long |
suspendTimer()
Suspend the event processing timer.
|
String |
toString() |
protected static final long DEFAULT_WARN_DELAY
protected static final boolean DEFAULT_CHART
protected static final boolean DEFAULT_AUTO_PROPAGATE_SESSION_ID
protected static final boolean DEFAULT_AUTO_CLOSE_SESSION_ID
protected org.apache.commons.logging.Log logger
public void setBeanName(String beanName)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic String getName()
getName in interface EventProcessorpublic void setEventName(String eventName)
public void setEventNames(List<String> eventNames)
public void setRegistry(EventProcessorRegistry registry)
register with.public long getWarnDelay()
EventProcessorgetWarnDelay in interface EventProcessorDEFAULT_WARN_DELAY)public void setWarnDelay(long warnDelay)
warnDelay - the time allowed for processing before a warning is loggedgetWarnDelay()public boolean isChart()
EventProcessorisChart in interface EventProcessorpublic void setChart(boolean chart)
chart - true to tag results for chartingisChart()public void setAutoPropagateSessionId(boolean autoPropagateSessionId)
default session ID propagation
behaviourautoPropagateSessionId - true to propagate session IDs to the next event
otherwise false (default: true)public void setAutoCloseSessionId(boolean autoCloseSessionId)
default session ID auto-close
behaviourautoCloseSessionId - true to allow the framework to aut-close sessions (default: true)public boolean isAutoPropagateSessionId()
EventProcessorisAutoPropagateSessionId in interface EventProcessorpublic boolean isAutoCloseSessionId()
EventProcessorisAutoCloseSessionId in interface EventProcessorpublic void register()
protected long suspendTimer()
IllegalStateException - if the timer is not runningprotected long resumeTimer()
IllegalStateException - if the timer is is not suspendedprotected long stopTimer()
IllegalStateException - if the timer is is not running or suspendedpublic final EventResult processEvent(Event event, org.apache.commons.lang3.time.StopWatch stopWatch) throws Exception
StopWatch.start() and StopWatch.stop()
the timer to better reflect actual event processing.
The implementation overrides this method to store the StopWatch in a thread-local.processEvent in interface EventProcessorevent - the event (along with associated data)stopWatch - the timer that will be used or null to have one
created and attached to the process automaticallyExceptionprotected abstract EventResult processEvent(Event event) throws Exception
event - the event (along with associated data)ExceptionsuspendTimer(),
resumeTimer(),
stopTimer()Copyright © 2005–2018 Alfresco Software. All rights reserved.