public class SimpleAsyncPollingEventListenerContainer extends AbstractEventListenerContainer
GigaSpace.asyncTake(Object)
in order to simulate events
(optionally transactional).
Actual event listener is perfomed in an AsyncFutureListener
, and once the result
is processed, another async operation is perfomed. This allows to require no threads running
and perfoming the blocking take operation as is the case with the SimplePollingEventListenerContainer
.
The number of async operarions executed on startup can be controlled using setConcurrentConsumers(int)
.
The rest of the operations will be driven by the results arriving, but in essence, there will be concurrent async
operations performed based on the inital number of concurrent consumers.
The actual execution of an async operation is abstracted using AsyncOperationHandler
with default implementation for take, read, and exclusive read lock.
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_RECEIVE_TIMEOUT
The default receive timeout: 60000 ms = 60 seconds = 1 minute.
|
beanName, disableTransactionValidation, exceptionHandler, logger
Constructor and Description |
---|
SimpleAsyncPollingEventListenerContainer() |
Modifier and Type | Method and Description |
---|---|
protected void |
doAfterStart() |
protected void |
doInitialize()
A callback to perform custom initialization steps.
|
protected void |
doShutdown()
Perform any custom shutdown operations.
|
protected void |
dump(PrintWriter writer) |
protected String |
getEventListenerContainerType() |
String |
getName() |
protected long |
getReceiveTimeout()
Returns the timeout used for receive calls, in millisecond.
|
ServiceDetails[] |
getServicesDetails()
Retruns one or more service details that the service exposes.
|
ServiceMonitors[] |
getServicesMonitors()
Retruns one or more service details that the service exposes.
|
void |
initialize()
Initialize this container.
|
void |
setAsyncOperationHandler(AsyncOperationHandler asyncOperationHandler)
Sets the async operation handler abstracting the actual async operation perfomred.
|
void |
setConcurrentConsumers(int concurrentConsumers)
Sets the number of concurrent async operation performed by this container.
|
void |
setReceiveTimeout(long receiveTimeout)
Set the timeout to use for receive calls, in milliseconds.
|
afterPropertiesSet, destroy, doBeforeStop, doRescheduleTask, doStart, doStop, executeListener, getActualEventListener, getApplicationContext, getBeanName, getEventListener, getEventListenerClass, getExceptionHandler, getFailedEvents, getGigaSpace, getProcessedEvents, getReceiveTemplate, getStatus, getTemplate, getTransactionDefinition, getTransactionManager, getTransactionManagerName, handleListenerException, invokeExceptionListener, invokeListener, isActive, isDynamicTemplate, isPerformSnapshot, isRunning, isTransactional, message, onApplicationEvent, process, quiesceStateChanged, registerMetrics, rescheduleTaskIfNecessary, setActiveWhenPrimary, setApplicationContext, setAutoStart, setBeanName, setDisableTransactionValidation, setDynamicTemplate, setEventListener, setEventListenerRef, setExceptionHandler, setGigaSpace, setPerformSnapshot, setProcessingUnitContainerContext, setRegisterSpaceModeListener, setTemplate, setTransactionIsolationLevel, setTransactionIsolationLevelName, setTransactionManager, setTransactionName, setTransactionTimeout, shutdown, start, stop, unregisterMetrics, validateConfiguration, waitWhileNotRunning
public static final long DEFAULT_RECEIVE_TIMEOUT
public SimpleAsyncPollingEventListenerContainer()
public void setReceiveTimeout(long receiveTimeout)
NOTE: This value needs to be smaller than the transaction timeout used by the transaction manager (in the appropriate unit, of course).
GigaSpace.take(Object,long)
protected long getReceiveTimeout()
public void setAsyncOperationHandler(AsyncOperationHandler asyncOperationHandler)
public void setConcurrentConsumers(int concurrentConsumers)
public ServiceDetails[] getServicesDetails()
ServiceDetailsProvider
public ServiceMonitors[] getServicesMonitors()
ServiceMonitorsProvider
public String getName()
protected String getEventListenerContainerType()
getEventListenerContainerType
in class AbstractEventListenerContainer
protected void dump(PrintWriter writer)
dump
in class AbstractEventListenerContainer
public void initialize() throws DataAccessException
AbstractEventListenerContainer
true
will call AbstractEventListenerContainer.doStart()
(if it is set to true
,
lifecycle of the container will be controlled by the current space mode).
AbstractEventListenerContainer.doInitialize()
will be called for additional initialization after the possible
AbstractEventListenerContainer.doStart()
call.initialize
in class AbstractEventListenerContainer
DataAccessException
AbstractEventListenerContainer.onApplicationEvent(org.springframework.context.ApplicationEvent)
protected void doInitialize() throws DataAccessException
AbstractEventListenerContainer
doInitialize
in class AbstractEventListenerContainer
DataAccessException
protected void doShutdown() throws DataAccessException
AbstractEventListenerContainer
doShutdown
in class AbstractEventListenerContainer
DataAccessException
AbstractEventListenerContainer.shutdown()
protected void doAfterStart() throws DataAccessException
doAfterStart
in class AbstractEventListenerContainer
DataAccessException
Copyright © GigaSpaces.