|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.data.gemfire.listener.ContinuousQueryListenerContainer
public class ContinuousQueryListenerContainer
Container providing asynchronous behaviour for GemFire continuous queries.
BeanNameAware,
DisposableBean,
InitializingBean,
SmartLifecycle,
SimpleAsyncTaskExecutor,
TaskExecutor,
RegionService,
Pool,
PoolManager,
CqEvent,
CqListener,
CqQuery,
QueryService| Field Summary | |
|---|---|
static String |
DEFAULT_THREAD_NAME_PREFIX
|
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
|---|---|
ContinuousQueryListenerContainer()
|
|
| Method Summary | |
|---|---|
void |
addListener(ContinuousQueryDefinition definition)
Adds a Continuous Query (CQ) definition to the (potentially running) container. |
void |
afterPropertiesSet()
|
protected TaskExecutor |
createDefaultTaskExecutor()
Creates a default TaskExecutor. |
void |
destroy()
|
protected void |
executeListener(ContinuousQueryListener listener,
com.gemstone.gemfire.cache.query.CqEvent event)
Execute the specified listener. |
int |
getPhase()
Gets the phase in which this CQ listener container will start in the Spring container. |
protected void |
handleListenerException(Throwable e)
Handle the given exception that arose during listener execution. |
protected void |
invokeErrorHandler(Throwable e)
Invoke the registered ErrorHandler, if any. |
boolean |
isActive()
Determines whether this container is currently active, that is, whether it has been setup (initialized) but not shutdown yet. |
boolean |
isAutoStartup()
Determines whether this CQ listener container will automatically start on startup. |
boolean |
isRunning()
Determines whether the container has be started and is currently running. |
void |
setAutoStartup(boolean autoStartup)
Sets whether the CQ listener container should automatically start on startup. |
void |
setBeanName(String name)
Set the name of the bean in the bean factory that created this bean. |
void |
setCache(com.gemstone.gemfire.cache.RegionService cache)
Set the underlying RegionService (GemFire Cache) used for registering Queries. |
void |
setErrorHandler(ErrorHandler errorHandler)
Set an ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a CQ event. |
void |
setPhase(int phase)
Sets the phase in which this CQ listener container will start in the Spring container. |
void |
setPoolName(String poolName)
Set the name of the Pool used for performing the queries by this container. |
void |
setQueryListeners(Set<ContinuousQueryDefinition> queries)
Attaches the given query definitions. |
void |
setQueryService(com.gemstone.gemfire.cache.query.QueryService service)
Set the GemFire QueryService used by this container to create ContinuousQueries (CQ). |
void |
setTaskExecutor(Executor taskExecutor)
Sets the Task Executor used for running the event listeners when messages are received. |
void |
start()
|
void |
stop()
|
void |
stop(Runnable callback)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_THREAD_NAME_PREFIX
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public ContinuousQueryListenerContainer()
| Method Detail |
|---|
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanprotected TaskExecutor createDefaultTaskExecutor()
The default implementation builds a SimpleAsyncTaskExecutor
with the specified bean name (or the class name, if no bean name is specified) as thread name prefix.
SimpleAsyncTaskExecutor.SimpleAsyncTaskExecutor(String)public void start()
start in interface Lifecyclepublic void stop()
stop in interface Lifecyclepublic void stop(Runnable callback)
stop in interface SmartLifecycle
public void destroy()
throws Exception
destroy in interface DisposableBeanExceptionpublic final boolean isActive()
public boolean isRunning()
isRunning in interface Lifecyclepublic boolean isAutoStartup()
isAutoStartup in interface SmartLifecycleSmartLifecycle.isAutoStartup()public void setAutoStartup(boolean autoStartup)
autoStartup - a boolean value indicating whether this CQ listener container should automatically start.public void setBeanName(String name)
Invoked after population of normal bean properties but before an
init callback such as InitializingBean.afterPropertiesSet()
or a custom init-method.
setBeanName in interface BeanNameAwarename - the name of the bean in the factory.public void setCache(com.gemstone.gemfire.cache.RegionService cache)
cache - the RegionService (GemFire Cache) used for registering Queries.RegionServicepublic void setErrorHandler(ErrorHandler errorHandler)
errorHandler - the ErrorHandler invoked when uncaught exceptions are thrown while processing the CQ event.ErrorHandlerpublic int getPhase()
getPhase in interface PhasedPhased.getPhase()public void setPhase(int phase)
phase - the phase value of this CQ listener container.public void setPoolName(String poolName)
Pool used for performing the queries by this container.
poolName - the name of the pool to be used by the containerpublic void setQueryListeners(Set<ContinuousQueryDefinition> queries)
queries - set of queriespublic void setQueryService(com.gemstone.gemfire.cache.query.QueryService service)
service - the GemFire QueryService object used by the container to create ContinuousQueries (CQ).QueryServicepublic void setTaskExecutor(Executor taskExecutor)
SimpleAsyncTaskExecutor will be used by default.
The task executor can be adjusted depending on the work done by the listeners and the number of
messages coming in.
taskExecutor - The Task Executor used to run event listeners when query results messages are received.Executorpublic void addListener(ContinuousQueryDefinition definition)
definition - Continuous Query (CQ) definitionContinuousQueryDefinition,
doAddListener(ContinuousQueryDefinition)
protected void executeListener(ContinuousQueryListener listener,
com.gemstone.gemfire.cache.query.CqEvent event)
listener - the ContinuousQueryListener to notify of the CQ event.event - the CQ event.handleListenerException(Throwable)protected void handleListenerException(Throwable e)
The default implementation logs the exception at error level. This can be overridden in subclasses.
e - the exception to handleprotected void invokeErrorHandler(Throwable e)
e - the uncaught error that arose during event processing.setErrorHandler(org.springframework.util.ErrorHandler)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||