GigaSpaces XAP 7.0 API

org.openspaces.events
Class AbstractTemplateEventListenerContainer

java.lang.Object
  extended by org.openspaces.events.AbstractSpaceListeningContainer
      extended by org.openspaces.events.AbstractEventListenerContainer
          extended by org.openspaces.events.AbstractTemplateEventListenerContainer
All Implemented Interfaces:
EventListener, ServiceDetailsProvider, ServiceMonitorsProvider, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ApplicationListener, Lifecycle
Direct Known Subclasses:
AbstractTransactionalEventListenerContainer

public abstract class AbstractTemplateEventListenerContainer
extends AbstractEventListenerContainer

A simple base class that provides support methods for Template based event listeners.

There are several ways a template can be provided. The first is by explicitly setting it using setTemplate(Object). The second option is for the event listener to implement an interface called EventTemplateProvider. The last option is to annotate a method within the event listener that will return the actual template using EventTemplate annotation.

Author:
kimchy

Field Summary
 
Fields inherited from class org.openspaces.events.AbstractEventListenerContainer
failedEvents, processedEvents
 
Fields inherited from class org.openspaces.events.AbstractSpaceListeningContainer
beanName, logger
 
Constructor Summary
AbstractTemplateEventListenerContainer()
           
 
Method Summary
 void afterPropertiesSet()
          Delegates to AbstractSpaceListeningContainer.validateConfiguration() and AbstractSpaceListeningContainer.initialize().
protected  Object getReceiveTemplate()
          Returns the template to be used for receive operations.
protected  Object getTemplate()
          Returns the template that will be used.
 void initialize()
          Initialize this container.
protected  boolean isPerformSnapshot()
           
 void setPerformSnapshot(boolean performSnapshot)
          If set to true will perform snapshot operation on the provided template before invoking registering as an event listener.
 void setTemplate(Object template)
          Sets the specified template to be used with the polling space operation.
 
Methods inherited from class org.openspaces.events.AbstractEventListenerContainer
doStart, executeListener, getActualEventListener, getApplicationContext, getEventListener, getEventListenerClass, getFailedEvents, getProcessedEvents, handleListenerException, invokeExceptionListener, invokeListener, setApplicationContext, setEventListener, setEventListenerRef
 
Methods inherited from class org.openspaces.events.AbstractSpaceListeningContainer
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
 

Constructor Detail

AbstractTemplateEventListenerContainer

public AbstractTemplateEventListenerContainer()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Description copied from class: AbstractSpaceListeningContainer
Delegates to AbstractSpaceListeningContainer.validateConfiguration() and AbstractSpaceListeningContainer.initialize().

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class AbstractSpaceListeningContainer

initialize

public void initialize()
                throws DataAccessException
Description copied from class: AbstractSpaceListeningContainer
Initialize this container. If this container is not configured with "activeWhenPrimary" flag set to 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.

Overrides:
initialize in class AbstractSpaceListeningContainer
Throws:
DataAccessException
See Also:
AbstractSpaceListeningContainer.onApplicationEvent(org.springframework.context.ApplicationEvent)

setTemplate

public void setTemplate(Object template)
Sets the specified template to be used with the polling space operation.

See Also:
GigaSpace.take(Object,long)

getTemplate

protected Object getTemplate()
Returns the template that will be used. Note, in order to perform receive operations, the getReceiveTemplate() should be used.


getReceiveTemplate

protected Object getReceiveTemplate()
Returns the template to be used for receive operations. If setPerformSnapshot(boolean) is set to true (the default) will return the snapshot of the provided template.


setPerformSnapshot

public void setPerformSnapshot(boolean performSnapshot)
If set to true will perform snapshot operation on the provided template before invoking registering as an event listener.

See Also:
GigaSpace.snapshot(Object)

isPerformSnapshot

protected boolean isPerformSnapshot()

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.