org.apache.ignite.cache.query

## 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.
  See Also:
    `ContinuousQuery`, `ContinuousQueryWithTransformer`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DFLT_AUTO_UNSUBSCRIBE` Default value for automatic unsubscription flag.
    `static int` | `DFLT_PAGE_SIZE` Default page size.
    `static long` | `DFLT_TIME_INTERVAL` Maximum default time interval after which buffer will be flushed (if buffering is enabled).

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractContinuousQuery()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.
    `long` | `getTimeInterval()` Gets time interval.
    `boolean` | `isAutoUnsubscribe()` Gets automatic unsubscription flag value.
    `boolean` | `isIncludeExpired()` Gets the flag value defining whether to notify about `EventType.EXPIRED` events.
    `AbstractContinuousQuery<K,V>` | `setAutoUnsubscribe(boolean autoUnsubscribe)` Sets automatic unsubscribe flag.
    `void` | `setIncludeExpired(boolean includeExpired)` Sets the flag value defining whether to notify about `EventType.EXPIRED` events.
    `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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DFLT_PAGE_SIZE

          public static final int DFLT_PAGE_SIZE

      Default page size. Size of `1` means 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

  - ### Constructor Detail

    - #### AbstractContinuousQuery

          public AbstractContinuousQuery()

  - ### 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:
        `this` for 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 `IgniteAsyncCallback` then it is executed in async callback pool (see `IgniteConfiguration.getAsyncCallbackPoolSize()`) that allow to perform a cache operations.

      Parameters:
        `rmtFilterFactory` - Key-value filter factory.
      Returns:
        `this` for 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 `0` which means that time check is disabled and entries will be sent only when buffer is full.

      Parameters:
        `timeInterval` - Time interval.
      Returns:
        `this` for 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:
        `this` for chaining.

    - #### isAutoUnsubscribe

          public boolean isAutoUnsubscribe()

      Gets automatic unsubscription flag value.
      Returns:
        Automatic unsubscription flag.

    - #### setIncludeExpired

          public void setIncludeExpired(boolean includeExpired)

      Sets the flag value defining whether to notify about `EventType.EXPIRED` events. If `true`, then the remote listener will get notifications about entries expired in cache. Otherwise, only `EventType.CREATED`, `EventType.UPDATED` and `EventType.REMOVED` events will be fired in the remote listener.

      This flag is `false` by default, so `EventType.EXPIRED` events are disabled.

      Parameters:
        `includeExpired` - Whether to notify about `EventType.EXPIRED` events.

    - #### isIncludeExpired

          public boolean isIncludeExpired()

      Gets the flag value defining whether to notify about `EventType.EXPIRED` events.
      Returns:
        Whether to notify about `EventType.EXPIRED` events.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021