Class CacheContinuousQueryHandler<K,V>
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler<K,V>
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,GridContinuousHandler
- Direct Known Subclasses:
CacheContinuousQueryHandlerV2
public class CacheContinuousQueryHandler<K,V> extends Object implements GridContinuousHandler
Continuous query handler.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.continuous.GridContinuousHandler
GridContinuousHandler.RegisterStatus
-
-
Field Summary
Fields Modifier and Type Field Description static intDFLT_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLDstatic intDFLT_CONTINUOUS_QUERY_LISTENER_MAX_BUFFER_SIZEstatic StringIGNITE_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLDstatic StringIGNITE_CONTINUOUS_QUERY_LISTENER_MAX_BUFFER_SIZEprotected IgniteInternalFuture<Void>initFutInitialization future.protected IgniteInternalFuture<Void>p2pUnmarshalFutP2P unmarshalling future.
-
Constructor Summary
Constructors Constructor Description CacheContinuousQueryHandler()Required byExternalizable.CacheContinuousQueryHandler(String cacheName, Object topic, @Nullable javax.cache.event.CacheEntryUpdatedListener<K,V> locLsnr, @Nullable CacheEntryEventSerializableFilter<K,V> rmtFilter, boolean oldValRequired, boolean sync, boolean ignoreExpired, boolean ignoreClsNotFound)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcacheName()GridContinuousHandlerclone()Clones this handler.GridContinuousBatchcreateBatch()Creates new batch.booleanfilter(org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEvent evt)voidflushOnNodeLeft()Node which started routine leave topology.javax.cache.event.CacheEntryEventFiltergetEventFilter()protected javax.cache.event.CacheEntryEventFiltergetEventFilter0()Returns an event filter without waiting on the unmarshalling future.@Nullable IgniteClosure<javax.cache.event.CacheEntryEvent<? extends K,? extends V>,?>getTransformer()IgniteClosure<javax.cache.event.CacheEntryEvent<? extends K,? extends V>,?>getTransformer0()protected voidinitRemoteFilter(javax.cache.event.CacheEntryEventFilter filter, GridKernalContext ctx)Performs resource injection and checks asynchrony for the provided remote filter.voidinternal(boolean internal)booleanisEvents()booleanisMarshalled()booleanisMessaging()booleanisQuery()booleankeepBinary()voidkeepBinary(boolean keepBinary)javax.cache.event.CacheEntryUpdatedListener<K,V>localListener()booleanlocalOnly()voidlocalOnly(boolean locOnly)@Nullable ContinuousQueryWithTransformer.EventListener<?>localTransformedEventListener()voidnotifyCallback(UUID nodeId, UUID routineId, Collection<?> objs, GridKernalContext ctx)Notifies local callback.booleannotifyExisting()voidnotifyExisting(boolean notifyExisting)booleanoldValueRequired()voidonBatchAcknowledged(UUID routineId, GridContinuousBatch batch, GridKernalContext ctx)Called when ack for a batch is received from client.voidonClientDisconnected()Client node disconnected callback.@Nullable ObjectorderedTopic()voidp2pMarshal(GridKernalContext ctx)Deploys and marshals inner objects (called only if peer deployment is enabled).voidp2pUnmarshal(UUID nodeId, GridKernalContext ctx)Unmarshals inner objects (called only if peer deployment is enabled).protected <T> Tp2pUnmarshal(org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryDeployableObject depObj, UUID nodeId, GridKernalContext ctx)voidreadExternal(ObjectInput in)GridContinuousHandler.RegisterStatusregister(UUID nodeId, UUID routineId, GridKernalContext ctx)Registers listener.voidskipPrimaryCheck(boolean skipPrimaryCheck)voidtaskNameHash(int taskHash)StringtoString()voidunregister(UUID routineId, GridKernalContext ctx)Unregisters listener.Map<Integer,T2<Long,Long>>updateCounters()voidupdateCounters(AffinityTopologyVersion topVer, Map<UUID,Map<Integer,T2<Long,Long>>> cntrsPerNode, Map<Integer,T2<Long,Long>> cntrs)voidwriteExternal(ObjectOutput out)
-
-
-
Field Detail
-
DFLT_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLD
public static final int DFLT_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLD
-
DFLT_CONTINUOUS_QUERY_LISTENER_MAX_BUFFER_SIZE
public static final int DFLT_CONTINUOUS_QUERY_LISTENER_MAX_BUFFER_SIZE
-
IGNITE_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLD
@SystemProperty(value="The size of the buffer with acknowledgment events that are sent to backup nodes", type=java.lang.Long.class, defaults="100") public static final String IGNITE_CONTINUOUS_QUERY_BACKUP_ACK_THRESHOLD
- See Also:
- Constant Field Values
-
IGNITE_CONTINUOUS_QUERY_LISTENER_MAX_BUFFER_SIZE
@SystemProperty(value="The maximum size of the continuous query listener buffer. 10% of events are dropped once the buffer is full", type=java.lang.Long.class, defaults="10000") public static final String IGNITE_CONTINUOUS_QUERY_LISTENER_MAX_BUFFER_SIZE
- See Also:
- Constant Field Values
-
p2pUnmarshalFut
protected transient IgniteInternalFuture<Void> p2pUnmarshalFut
P2P unmarshalling future.
-
initFut
protected transient IgniteInternalFuture<Void> initFut
Initialization future.
-
-
Constructor Detail
-
CacheContinuousQueryHandler
public CacheContinuousQueryHandler()
Required byExternalizable.
-
CacheContinuousQueryHandler
public CacheContinuousQueryHandler(String cacheName, Object topic, @Nullable @Nullable javax.cache.event.CacheEntryUpdatedListener<K,V> locLsnr, @Nullable @Nullable CacheEntryEventSerializableFilter<K,V> rmtFilter, boolean oldValRequired, boolean sync, boolean ignoreExpired, boolean ignoreClsNotFound)
Constructor.- Parameters:
cacheName- Cache name.topic- Topic for ordered messages.locLsnr- Local listener.rmtFilter- Remote filter.oldValRequired- Old value required flag.sync- Synchronous flag.ignoreExpired- Ignore expired events flag.
-
-
Method Detail
-
internal
public void internal(boolean internal)
- Parameters:
internal- Internal query.
-
notifyExisting
public void notifyExisting(boolean notifyExisting)
- Parameters:
notifyExisting- Notify existing.
-
notifyExisting
public boolean notifyExisting()
- Returns:
Trueif handler should obtain existing entries,falseotherwise.
-
oldValueRequired
public boolean oldValueRequired()
- Returns:
Trueif old value required for handler,falseotherwise.
-
localListener
public javax.cache.event.CacheEntryUpdatedListener<K,V> localListener()
- Returns:
- Local listener.
-
localOnly
public void localOnly(boolean locOnly)
- Parameters:
locOnly- Local only.
-
localOnly
public boolean localOnly()
- Returns:
Trueif handler are local only,falseotherwise.
-
taskNameHash
public void taskNameHash(int taskHash)
- Parameters:
taskHash- Task hash.
-
skipPrimaryCheck
public void skipPrimaryCheck(boolean skipPrimaryCheck)
- Parameters:
skipPrimaryCheck- Whether to skip primary check for REPLICATED cache.
-
isEvents
public boolean isEvents()
- Specified by:
isEventsin interfaceGridContinuousHandler- Returns:
Trueif for events.
-
isMessaging
public boolean isMessaging()
- Specified by:
isMessagingin interfaceGridContinuousHandler- Returns:
Trueif for messaging.
-
isQuery
public boolean isQuery()
- Specified by:
isQueryin interfaceGridContinuousHandler- Returns:
Trueif for continuous queries.
-
keepBinary
public boolean keepBinary()
- Specified by:
keepBinaryin interfaceGridContinuousHandler- Returns:
Trueif Ignite Binary objects should be passed to the listener and filter.
-
keepBinary
public void keepBinary(boolean keepBinary)
- Parameters:
keepBinary- Keep binary flag.
-
cacheName
public String cacheName()
- Specified by:
cacheNamein interfaceGridContinuousHandler- Returns:
- Cache name if this is a continuous query handler.
-
updateCounters
public void updateCounters(AffinityTopologyVersion topVer, Map<UUID,Map<Integer,T2<Long,Long>>> cntrsPerNode, Map<Integer,T2<Long,Long>> cntrs)
- Specified by:
updateCountersin interfaceGridContinuousHandler- Parameters:
topVer- Topology version.cntrsPerNode- Init state partition counters for node.cntrs- Init state for partition counters.
-
updateCounters
public Map<Integer,T2<Long,Long>> updateCounters()
- Specified by:
updateCountersin interfaceGridContinuousHandler- Returns:
- Init state for partition counters.
-
register
public GridContinuousHandler.RegisterStatus register(UUID nodeId, UUID routineId, GridKernalContext ctx) throws IgniteCheckedException
Registers listener.- Specified by:
registerin interfaceGridContinuousHandler- Parameters:
nodeId- ID of the node that started routine.routineId- Routine ID.ctx- Kernal context.- Returns:
- Whether listener was actually registered.
- Throws:
IgniteCheckedException- In case of error.
-
initRemoteFilter
protected void initRemoteFilter(javax.cache.event.CacheEntryEventFilter filter, GridKernalContext ctx) throws IgniteCheckedExceptionPerforms resource injection and checks asynchrony for the provided remote filter.- Parameters:
filter- Remote filter.ctx- Kernal context.- Throws:
IgniteCheckedException- If failed to perform resource injection.
-
getEventFilter
public javax.cache.event.CacheEntryEventFilter getEventFilter() throws IgniteCheckedException- Returns:
- Cache entry event filter.
- Throws:
IgniteCheckedException- If P2P unmarshalling failed.
-
getEventFilter0
protected javax.cache.event.CacheEntryEventFilter getEventFilter0()
Returns an event filter without waiting on the unmarshalling future.- Returns:
- Cache entry event filter.
-
getTransformer
@Nullable public @Nullable IgniteClosure<javax.cache.event.CacheEntryEvent<? extends K,? extends V>,?> getTransformer() throws IgniteCheckedException
- Returns:
- Cache entry event transformer.
- Throws:
IgniteCheckedException
-
getTransformer0
public IgniteClosure<javax.cache.event.CacheEntryEvent<? extends K,? extends V>,?> getTransformer0()
- Returns:
- Cache entry event transformer.
-
localTransformedEventListener
@Nullable public @Nullable ContinuousQueryWithTransformer.EventListener<?> localTransformedEventListener()
- Returns:
- Local listener of transformed events.
-
unregister
public void unregister(UUID routineId, GridKernalContext ctx)
Unregisters listener.- Specified by:
unregisterin interfaceGridContinuousHandler- Parameters:
routineId- Routine ID.ctx- Kernal context.
-
notifyCallback
public void notifyCallback(UUID nodeId, UUID routineId, Collection<?> objs, GridKernalContext ctx)
Notifies local callback.- Specified by:
notifyCallbackin interfaceGridContinuousHandler- Parameters:
nodeId- ID of the node where notification came from.routineId- Routine ID.objs- Notification objects.ctx- Kernal context.
-
filter
public boolean filter(org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEvent evt)
- Parameters:
evt- Query event.- Returns:
Trueif event passed filter otherwisefalse.
-
onClientDisconnected
public void onClientDisconnected()
Client node disconnected callback.- Specified by:
onClientDisconnectedin interfaceGridContinuousHandler
-
flushOnNodeLeft
public void flushOnNodeLeft()
Node which started routine leave topology.- Specified by:
flushOnNodeLeftin interfaceGridContinuousHandler
-
p2pMarshal
public void p2pMarshal(GridKernalContext ctx) throws IgniteCheckedException
Deploys and marshals inner objects (called only if peer deployment is enabled).- Specified by:
p2pMarshalin interfaceGridContinuousHandler- Parameters:
ctx- Kernal context.- Throws:
IgniteCheckedException- In case of error.
-
p2pUnmarshal
public void p2pUnmarshal(UUID nodeId, GridKernalContext ctx) throws IgniteCheckedException
Unmarshals inner objects (called only if peer deployment is enabled).- Specified by:
p2pUnmarshalin interfaceGridContinuousHandler- Parameters:
nodeId- Sender node ID.ctx- Kernal context.- Throws:
IgniteCheckedException- In case of error.
-
isMarshalled
public boolean isMarshalled()
- Returns:
- Whether the handler is marshalled for peer class loading.
-
p2pUnmarshal
protected <T> T p2pUnmarshal(org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryDeployableObject depObj, UUID nodeId, GridKernalContext ctx) throws IgniteCheckedException- Type Parameters:
T- Result type.- Parameters:
depObj- Deployable object to unmarshal.nodeId- Sender node Id.ctx- Kernal context.- Returns:
- Unmarshalled object.
- Throws:
IgniteCheckedException- In case of unmarshalling failures.
-
createBatch
public GridContinuousBatch createBatch()
Creates new batch.- Specified by:
createBatchin interfaceGridContinuousHandler- Returns:
- New batch.
-
onBatchAcknowledged
public void onBatchAcknowledged(UUID routineId, GridContinuousBatch batch, GridKernalContext ctx)
Called when ack for a batch is received from client.- Specified by:
onBatchAcknowledgedin interfaceGridContinuousHandler- Parameters:
routineId- Routine ID.batch- Acknowledged batch.ctx- Kernal context.
-
orderedTopic
@Nullable public @Nullable Object orderedTopic()
- Specified by:
orderedTopicin interfaceGridContinuousHandler- Returns:
- Topic for ordered notifications. If
null, notifications will be sent in non-ordered messages.
-
clone
public GridContinuousHandler clone()
Clones this handler.- Specified by:
clonein interfaceGridContinuousHandler- Overrides:
clonein classObject- Returns:
- Clone of this handler.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
-