|
GigaSpaces XAP 7.0 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 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()
|
long |
getFailedEvents()
|
long |
getProcessedEvents()
|
protected void |
handleListenerException(Throwable ex)
Handles exception that occurs during the event listening process. |
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). |
Methods inherited from class org.openspaces.events.AbstractSpaceListeningContainer |
---|
afterPropertiesSet, destroy, doAfterStart, doBeforeStop, doInitialize, doRescheduleTask, doShutdown, doStop, getBeanName, getGigaSpace, getStatus, initialize, 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 final AtomicLong processedEvents
protected final AtomicLong failedEvents
Constructor Detail |
---|
public AbstractEventListenerContainer()
Method Detail |
---|
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()
protected void doStart() throws DataAccessException
doStart
in class AbstractSpaceListeningContainer
DataAccessException
protected void executeListener(SpaceDataEventListener eventListener, Object eventData, TransactionStatus txStatus, Object source) throws DataAccessException
AbstractSpaceListeningContainer.isRunning()
.
eventData
- The event data objecttxStatus
- An optional transaction status allowing to rollback a transaction programmaticallysource
- An optional source (or additional event information)
DataAccessException
protected void invokeListener(SpaceDataEventListener eventListener, Object eventData, TransactionStatus txStatus, Object source) throws DataAccessException
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
protected void handleListenerException(Throwable ex)
ex
- the exception to handleprotected void invokeExceptionListener(Exception e)
public long getProcessedEvents()
public long getFailedEvents()
|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |