|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.events.AbstractSpaceListeningContainer org.openspaces.events.AbstractEventListenerContainer
public abstract class AbstractEventListenerContainer
A simple based class for SpaceDataEventListener
based containers. Allowing to register a
listener and provides several support methods like
invokeListener(SpaceDataEventListener, Object, org.springframework.transaction.TransactionStatus, Object)
in
order to simplify event listener based containers.
Field Summary | |
---|---|
protected EventExceptionHandler |
exceptionHandler
|
protected AtomicLong |
failedEvents
|
protected AtomicLong |
processedEvents
|
Fields inherited from class org.openspaces.events.AbstractSpaceListeningContainer |
---|
beanName, logger |
Constructor Summary | |
---|---|
AbstractEventListenerContainer()
|
Method Summary | |
---|---|
protected void |
doStart()
Only start if we have a listener registered. |
protected void |
executeListener(SpaceDataEventListener eventListener,
Object eventData,
TransactionStatus txStatus,
Object source)
Executes the given listener if the container is running ( AbstractSpaceListeningContainer.isRunning() . |
protected Object |
getActualEventListener()
|
protected ApplicationContext |
getApplicationContext()
|
protected SpaceDataEventListener |
getEventListener()
|
protected Class<?> |
getEventListenerClass()
|
protected EventExceptionHandler |
getExceptionHandler()
|
long |
getFailedEvents()
|
long |
getProcessedEvents()
|
protected void |
handleListenerException(Throwable ex)
Handles exception that occurs during the event listening process. |
void |
initialize()
Initialize this container. |
protected void |
invokeExceptionListener(Exception e)
A callback to handle exception. |
protected void |
invokeListener(SpaceDataEventListener eventListener,
Object eventData,
TransactionStatus txStatus,
Object source)
Invokes the configured SpaceDataEventListener based on the
provided data. |
void |
setApplicationContext(ApplicationContext applicationContext)
|
void |
setEventListener(SpaceDataEventListener eventListener)
Sets the event listener implementation that will be used to delegate events to. |
void |
setEventListenerRef(String eventListenerRef)
Sets an event listener bean reference name that will be used to lookup the actual listener bean (based on its name). |
void |
setExceptionHandler(EventExceptionHandler exceptionHandler)
Sets an exception handler that will be invoked when an exception occurs on the listener allowing to customize the handling of such cases. |
Methods inherited from class org.openspaces.events.AbstractSpaceListeningContainer |
---|
afterPropertiesSet, destroy, doAfterStart, doBeforeStop, doInitialize, doRescheduleTask, doShutdown, doStop, getBeanName, getGigaSpace, getStatus, isActive, isRunning, message, onApplicationEvent, rescheduleTaskIfNecessary, setActiveWhenPrimary, setAutoStart, setBeanName, setGigaSpace, setRegisterSpaceModeListener, shutdown, start, stop, validateConfiguration, waitWhileNotRunning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.openspaces.pu.service.ServiceDetailsProvider |
---|
getServicesDetails |
Methods inherited from interface org.openspaces.pu.service.ServiceMonitorsProvider |
---|
getServicesMonitors |
Field Detail |
---|
protected EventExceptionHandler exceptionHandler
protected final AtomicLong processedEvents
protected final AtomicLong failedEvents
Constructor Detail |
---|
public AbstractEventListenerContainer()
Method Detail |
---|
protected EventExceptionHandler getExceptionHandler()
public void setExceptionHandler(EventExceptionHandler exceptionHandler)
public void setEventListener(SpaceDataEventListener eventListener)
eventListener
- The event listener usedpublic void setEventListenerRef(String eventListenerRef)
getBean
for each
request of the listener.
protected SpaceDataEventListener getEventListener()
protected Object getActualEventListener()
public void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext
in interface ApplicationContextAware
protected ApplicationContext getApplicationContext()
protected Class<?> getEventListenerClass()
public void initialize() throws DataAccessException
AbstractSpaceListeningContainer
true
will call AbstractSpaceListeningContainer.doStart()
(if it is set to true
,
lifecycle of the container will be controlled by the current space mode).
AbstractSpaceListeningContainer.doInitialize()
will be called for additional initialization after the possible
AbstractSpaceListeningContainer.doStart()
call.
initialize
in class AbstractSpaceListeningContainer
DataAccessException
AbstractSpaceListeningContainer.onApplicationEvent(org.springframework.context.ApplicationEvent)
protected void doStart() throws DataAccessException
doStart
in class AbstractSpaceListeningContainer
DataAccessException
protected void executeListener(SpaceDataEventListener eventListener, Object eventData, TransactionStatus txStatus, Object source) throws Throwable
AbstractSpaceListeningContainer.isRunning()
.
eventData
- The event data objecttxStatus
- An optional transaction status allowing to rollback a transaction programmaticallysource
- An optional source (or additional event information)
Throwable
protected void invokeListener(SpaceDataEventListener eventListener, Object eventData, TransactionStatus txStatus, Object source) throws Throwable
SpaceDataEventListener
based on the
provided data. Currently simply delegates to
SpaceDataEventListener.onEvent(Object,org.openspaces.core.GigaSpace,org.springframework.transaction.TransactionStatus,Object)
.
eventData
- The event data objecttxStatus
- An optional transaction status allowing to rollback a transaction programmaticallysource
- An optional source (or additional event information)
DataAccessException
Throwable
protected void handleListenerException(Throwable ex)
ex
- the exception to handleprotected void invokeExceptionListener(Exception e)
public long getProcessedEvents()
public long getFailedEvents()
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |