Class AbstractContinuousQuery<K,V>
- java.lang.Object
-
- org.apache.ignite.cache.query.Query<javax.cache.Cache.Entry<K,V>>
-
- org.apache.ignite.cache.query.AbstractContinuousQuery<K,V>
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ContinuousQuery,ContinuousQueryWithTransformer
public abstract class AbstractContinuousQuery<K,V> extends Query<javax.cache.Cache.Entry<K,V>>
Base class for continuous query.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDFLT_AUTO_UNSUBSCRIBEDefault value for automatic unsubscription flag.static intDFLT_PAGE_SIZEDefault page size.static longDFLT_TIME_INTERVALMaximum default time interval after which buffer will be flushed (if buffering is enabled).
-
Constructor Summary
Constructors Constructor Description AbstractContinuousQuery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Query<javax.cache.Cache.Entry<K,V>>getInitialQuery()Gets initial query.javax.cache.configuration.Factory<? extends javax.cache.event.CacheEntryEventFilter<K,V>>getRemoteFilterFactory()Gets remote filter.longgetTimeInterval()Gets time interval.booleanisAutoUnsubscribe()Gets automatic unsubscription flag value.booleanisIncludeExpired()Gets the flag value defining whether to notify aboutEventType.EXPIREDevents.AbstractContinuousQuery<K,V>setAutoUnsubscribe(boolean autoUnsubscribe)Sets automatic unsubscribe flag.AbstractContinuousQuery<K,V>setIncludeExpired(boolean includeExpired)Sets the flag value defining whether to notify aboutEventType.EXPIREDevents.AbstractContinuousQuery<K,V>setInitialQuery(Query<javax.cache.Cache.Entry<K,V>> initQry)Sets initial query.AbstractContinuousQuery<K,V>setRemoteFilterFactory(javax.cache.configuration.Factory<? extends javax.cache.event.CacheEntryEventFilter<K,V>> rmtFilterFactory)Sets optional key-value filter factory.AbstractContinuousQuery<K,V>setTimeInterval(long timeInterval)Sets time interval.-
Methods inherited from class org.apache.ignite.cache.query.Query
getPageSize, isLocal, prepare, setLocal, setPageSize, toString
-
-
-
-
Field Detail
-
DFLT_PAGE_SIZE
public static final int DFLT_PAGE_SIZE
Default page size. Size of1means that all entries will be sent to master node immediately (buffering is disabled).- See Also:
- Constant Field Values
-
DFLT_TIME_INTERVAL
public static final long DFLT_TIME_INTERVAL
Maximum default time interval after which buffer will be flushed (if buffering is enabled).- See Also:
- Constant Field Values
-
DFLT_AUTO_UNSUBSCRIBE
public static final boolean DFLT_AUTO_UNSUBSCRIBE
Default value for automatic unsubscription flag. Remote filters will be unregistered by default if master node leaves topology.- See Also:
- Constant Field Values
-
-
Method Detail
-
setInitialQuery
public AbstractContinuousQuery<K,V> setInitialQuery(Query<javax.cache.Cache.Entry<K,V>> initQry)
Sets initial query.This query will be executed before continuous listener is registered which allows to iterate through entries which already existed at the time continuous query is executed.
- Parameters:
initQry- Initial query.- Returns:
thisfor chaining.
-
getInitialQuery
public Query<javax.cache.Cache.Entry<K,V>> getInitialQuery()
Gets initial query.- Returns:
- Initial query.
-
setRemoteFilterFactory
public AbstractContinuousQuery<K,V> setRemoteFilterFactory(javax.cache.configuration.Factory<? extends javax.cache.event.CacheEntryEventFilter<K,V>> rmtFilterFactory)
Sets optional key-value filter factory. This factory produces filter is called before entry is sent to the master node.WARNING: all operations that involve any kind of JVM-local or distributed locking (e.g., synchronization or transactional cache operations), should be executed asynchronously without blocking the thread that called the filter. Otherwise, you can get deadlocks.
If remote filter are annotated with
IgniteAsyncCallbackthen it is executed in async callback pool (seeIgniteConfiguration.getAsyncCallbackPoolSize()) that allow to perform a cache operations.- Parameters:
rmtFilterFactory- Key-value filter factory.- Returns:
thisfor chaining.- See Also:
IgniteAsyncCallback,IgniteConfiguration.getAsyncCallbackPoolSize()
-
getRemoteFilterFactory
public javax.cache.configuration.Factory<? extends javax.cache.event.CacheEntryEventFilter<K,V>> getRemoteFilterFactory()
Gets remote filter.- Returns:
- Remote filter.
-
setTimeInterval
public AbstractContinuousQuery<K,V> setTimeInterval(long timeInterval)
Sets time interval.When a cache update happens, entry is first put into a buffer. Entries from buffer will be sent to the master node only if the buffer is full (its size can be provided via
Query.setPageSize(int)method) or time provided via this method is exceeded.Default time interval is
0which means that time check is disabled and entries will be sent only when buffer is full.- Parameters:
timeInterval- Time interval.- Returns:
thisfor chaining.
-
getTimeInterval
public long getTimeInterval()
Gets time interval.- Returns:
- Time interval.
-
setAutoUnsubscribe
public AbstractContinuousQuery<K,V> setAutoUnsubscribe(boolean autoUnsubscribe)
Sets automatic unsubscribe flag.This flag indicates that query filters on remote nodes should be automatically unregistered if master node (node that initiated the query) leaves topology. If this flag is
false, filters will be unregistered only when the query is cancelled from master node, and won't ever be unregistered if master node leaves grid.Default value for this flag is
true.- Parameters:
autoUnsubscribe- Automatic unsubscription flag.- Returns:
thisfor chaining.
-
isAutoUnsubscribe
public boolean isAutoUnsubscribe()
Gets automatic unsubscription flag value.- Returns:
- Automatic unsubscription flag.
-
setIncludeExpired
public AbstractContinuousQuery<K,V> setIncludeExpired(boolean includeExpired)
Sets the flag value defining whether to notify aboutEventType.EXPIREDevents. Iftrue, then the remote listener will get notifications about entries expired in cache. Otherwise, onlyEventType.CREATED,EventType.UPDATEDandEventType.REMOVEDevents will be fired in the remote listener.This flag is
falseby default, soEventType.EXPIREDevents are disabled.- Parameters:
includeExpired- Whether to notify aboutEventType.EXPIREDevents.- Returns:
thisfor chaining.
-
isIncludeExpired
public boolean isIncludeExpired()
Gets the flag value defining whether to notify aboutEventType.EXPIREDevents.- Returns:
- Whether to notify about
EventType.EXPIREDevents.
-
-