public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implements IgniteEvents, Externalizable
IgniteEvents implementation.curFut| Constructor and Description |
|---|
IgniteEventsImpl()
Required by
Externalizable. |
IgniteEventsImpl(GridKernalContext ctx,
ClusterGroupAdapter prj,
boolean async) |
| Modifier and Type | Method and Description |
|---|---|
ClusterGroup |
clusterGroup()
Gets cluster group to which this
IgniteEvents instance belongs. |
protected IgniteEvents |
createAsyncInstance()
Creates component with asynchronous mode enabled.
|
void |
disableLocal(int[] types)
Disables provided events.
|
int[] |
enabledEvents()
Gets types of enabled events.
|
void |
enableLocal(int[] types)
Enables provided events.
|
boolean |
isEnabled(int type)
Check if event is enabled.
|
void |
localListen(IgnitePredicate<? extends Event> lsnr,
int[] types)
Adds an event listener for local events.
|
<T extends Event> |
localQuery(IgnitePredicate<T> p,
int... types)
Queries local node for events using passed-in predicate filter for event selection.
|
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
void |
recordLocal(Event evt)
Records customer user generated event.
|
<T extends Event> |
remoteListen(@Nullable IgniteBiPredicate<UUID,T> locLsnr,
@Nullable IgnitePredicate<T> rmtFilter,
int... types)
Adds event listener for specified events to all nodes in the cluster group (possibly including
local node if it belongs to the cluster group as well).
|
<T extends Event> |
remoteListen(int bufSize,
long interval,
boolean autoUnsubscribe,
@Nullable IgniteBiPredicate<UUID,T> locLsnr,
@Nullable IgnitePredicate<T> rmtFilter,
int... types)
Adds event listener for specified events to all nodes in the cluster group (possibly including
local node if it belongs to the cluster group as well).
|
<T extends Event> |
remoteListenAsync(@Nullable IgniteBiPredicate<UUID,T> locLsnr,
@Nullable IgnitePredicate<T> rmtFilter,
int... types)
Asynchronously adds event listener for specified events to all nodes in the cluster group (possibly including
local node if it belongs to the cluster group as well).
|
<T extends Event> |
remoteListenAsync(int bufSize,
long interval,
boolean autoUnsubscribe,
@Nullable IgniteBiPredicate<UUID,T> locLsnr,
@Nullable IgnitePredicate<T> rmtFilter,
int... types)
Asynchronously adds event listener for specified events to all nodes in the cluster group (possibly including
local node if it belongs to the cluster group as well).
|
<T extends Event> |
remoteQuery(IgnitePredicate<T> p,
long timeout,
int... types)
Queries nodes in this cluster group for events using passed in predicate filter for event
selection.
|
<T extends Event> |
remoteQueryAsync(IgnitePredicate<T> p,
long timeout,
int... types)
Asynchronously queries nodes in this cluster group for events using passed in predicate filter for event
selection.
|
boolean |
stopLocalListen(IgnitePredicate<? extends Event> lsnr,
int... types)
Removes local event listener.
|
void |
stopRemoteListen(UUID opId)
Stops listening to remote events.
|
IgniteFuture<Void> |
stopRemoteListenAsync(UUID opId)
Asynchronously stops listening to remote events.
|
<T extends Event> |
waitForLocal(@Nullable IgnitePredicate<T> filter,
int... types)
Waits for the specified events.
|
<T extends Event> |
waitForLocalAsync(@Nullable IgnitePredicate<T> filter,
int... types)
Create future to wait for the specified events.
|
void |
writeExternal(ObjectOutput out) |
createFuture, future, future, isAsync, saveOrGet, withAsyncclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwithAsyncfuture, isAsyncpublic IgniteEventsImpl()
Externalizable.public IgniteEventsImpl(GridKernalContext ctx, ClusterGroupAdapter prj, boolean async)
ctx - Kernal context.prj - Projection.async - Async support flag.public ClusterGroup clusterGroup()
IgniteEvents instance belongs.clusterGroup in interface IgniteEventsIgniteEvents instance belongs.public <T extends Event> List<T> remoteQuery(IgnitePredicate<T> p, long timeout, @Nullable int... types)
remoteQuery in interface IgniteEventsp - Predicate filter used to query events on remote nodes.timeout - Maximum time to wait for result, 0 to wait forever.types - Event types to be queried.public <T extends Event> IgniteFuture<List<T>> remoteQueryAsync(IgnitePredicate<T> p, long timeout, @Nullable int... types) throws IgniteException
remoteQueryAsync in interface IgniteEventsp - Predicate filter used to query events on remote nodes.timeout - Maximum time to wait for result, 0 to wait forever.types - Event types to be queried.IgniteException - If query failed.public <T extends Event> UUID remoteListen(@Nullable @Nullable IgniteBiPredicate<UUID,T> locLsnr, @Nullable @Nullable IgnitePredicate<T> rmtFilter, @Nullable int... types)
The listener can be unsubscribed automatically if local node stops, if locLsnr callback
returns false or if IgniteEvents.stopRemoteListen(UUID) or IgniteEvents.stopRemoteListenAsync(UUID) are called.
remoteListen in interface IgniteEventsT - Type of the event.locLsnr - Listener callback that is called on local node. If null, this events will be handled
on remote nodes by passed in rmtFilter.rmtFilter - Filter callback that is called on remote node. Only events that pass the remote filter
will be sent to local node. If null, all events of specified types will
be sent to local node. This remote filter can be used to pre-handle events remotely,
before they are passed in to local callback. It will be auto-unsubsribed on the node
where event occurred in case if it returns false.types - Types of events to listen for. If not provided, all events that pass the
provided remote filter will be sent to local node.Operation ID that can be passed to IgniteEvents.stopRemoteListen(UUID) or
IgniteEvents.stopRemoteListenAsync(UUID) methods to stop listening.public <T extends Event> IgniteFuture<UUID> remoteListenAsync(@Nullable @Nullable IgniteBiPredicate<UUID,T> locLsnr, @Nullable @Nullable IgnitePredicate<T> rmtFilter, @Nullable int... types) throws IgniteException
The listener can be unsubscribed automatically if local node stops, if locLsnr callback
returns false or if IgniteEvents.stopRemoteListen(UUID) or IgniteEvents.stopRemoteListenAsync(UUID) are called.
remoteListenAsync in interface IgniteEventsT - Type of the event.locLsnr - Listener callback that is called on local node. If null, this events will be handled
on remote nodes by passed in rmtFilter.rmtFilter - Filter callback that is called on remote node. Only events that pass the remote filter
will be sent to local node. If null, all events of specified types will
be sent to local node. This remote filter can be used to pre-handle events remotely,
before they are passed in to local callback. It will be auto-unsubsribed on the node
where event occurred in case if it returns false.types - Types of events to listen for. If not provided, all events that pass the
provided remote filter will be sent to local node.Operation ID that can be passed to IgniteEvents.stopRemoteListen(UUID) or
IgniteEvents.stopRemoteListenAsync(UUID) methods to stop listening.IgniteException - If failed to add listener.public <T extends Event> UUID remoteListen(int bufSize, long interval, boolean autoUnsubscribe, @Nullable @Nullable IgniteBiPredicate<UUID,T> locLsnr, @Nullable @Nullable IgnitePredicate<T> rmtFilter, @Nullable int... types)
Supports asynchronous execution (see IgniteAsyncSupport).
remoteListen in interface IgniteEventsT - Type of the event.bufSize - Remote events buffer size. Events from remote nodes won't be sent until buffer
is full or time interval is exceeded.interval - Maximum time interval after which events from remote node will be sent. Events
from remote nodes won't be sent until buffer is full or time interval is exceeded.autoUnsubscribe - Flag indicating that event listeners on remote nodes should be
automatically unregistered if master node (node that initiated event listening) leaves
topology. If this flag is false, listeners will be unregistered only when
IgniteEvents.stopRemoteListen(UUID) method is called, or the 'callback (locLsnr)'
passed in returns false.locLsnr - Callback that is called on local node. If this predicate returns true,
the implementation will continue listening to events. Otherwise, events
listening will be stopped and listeners will be unregistered on all nodes
in the cluster group. If null, this events will be handled on remote nodes by
passed in rmtFilter until local node stops (if 'autoUnsubscribe' is true)
or until IgniteEvents.stopRemoteListen(UUID) is called.rmtFilter - Filter callback that is called on remote node. Only events that pass the remote filter
will be sent to local node. If null, all events of specified types will
be sent to local node. This remote filter can be used to pre-handle events remotely,
before they are passed in to local callback. It will be auto-unsubsribed on the node
where event occurred in case if it returns false.types - Types of events to listen for. If not provided, all events that pass the
provided remote filter will be sent to local node.Operation ID that can be passed to IgniteEvents.stopRemoteListen(UUID) or
IgniteEvents.stopRemoteListen(UUID) methods to stop listening.IgniteEvents.stopRemoteListen(UUID),
IgniteEvents.stopRemoteListenAsync(UUID)public <T extends Event> IgniteFuture<UUID> remoteListenAsync(int bufSize, long interval, boolean autoUnsubscribe, @Nullable @Nullable IgniteBiPredicate<UUID,T> locLsnr, @Nullable @Nullable IgnitePredicate<T> rmtFilter, @Nullable int... types) throws IgniteException
remoteListenAsync in interface IgniteEventsT - Type of the event.bufSize - Remote events buffer size. Events from remote nodes won't be sent until buffer
is full or time interval is exceeded.interval - Maximum time interval after which events from remote node will be sent. Events
from remote nodes won't be sent until buffer is full or time interval is exceeded.autoUnsubscribe - Flag indicating that event listeners on remote nodes should be
automatically unregistered if master node (node that initiated event listening) leaves
topology. If this flag is false, listeners will be unregistered only when
IgniteEvents.stopRemoteListen(UUID) method is called, or the 'callback (locLsnr)'
passed in returns false.locLsnr - Callback that is called on local node. If this predicate returns true,
the implementation will continue listening to events. Otherwise, events
listening will be stopped and listeners will be unregistered on all nodes
in the cluster group. If null, this events will be handled on remote nodes by
passed in rmtFilter until local node stops (if 'autoUnsubscribe' is true)
or until IgniteEvents.stopRemoteListen(UUID) is called.rmtFilter - Filter callback that is called on remote node. Only events that pass the remote filter
will be sent to local node. If null, all events of specified types will
be sent to local node. This remote filter can be used to pre-handle events remotely,
before they are passed in to local callback. It will be auto-unsubsribed on the node
where event occurred in case if it returns false.types - Types of events to listen for. If not provided, all events that pass the
provided remote filter will be sent to local node.Operation ID that can be passed to IgniteEvents.stopRemoteListen(UUID)
or IgniteEvents.stopRemoteListen(UUID) methods to stop listening.IgniteException - If failed to add listener.IgniteEvents.stopRemoteListen(UUID),
IgniteEvents.stopRemoteListenAsync(UUID)public void stopRemoteListen(UUID opId)
IgniteEvents.clusterGroup().
Supports asynchronous execution (see IgniteAsyncSupport).
stopRemoteListen in interface IgniteEventsopId - Operation ID that was returned from
IgniteEvents.remoteListen(IgniteBiPredicate, IgnitePredicate, int...) method.IgniteEvents.remoteListen(IgniteBiPredicate, IgnitePredicate, int...),
IgniteEvents.remoteListenAsync(int, long, boolean, IgniteBiPredicate, IgnitePredicate, int...)public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException
IgniteEvents.clusterGroup().stopRemoteListenAsync in interface IgniteEventsopId - Operation ID that was returned from
IgniteEvents.remoteListen(IgniteBiPredicate, IgnitePredicate, int...) method.IgniteException - If failed to stop listeners.IgniteEvents.remoteListen(IgniteBiPredicate, IgnitePredicate, int...),
IgniteEvents.remoteListenAsync(int, long, boolean, IgniteBiPredicate, IgnitePredicate, int...)public <T extends Event> T waitForLocal(@Nullable @Nullable IgnitePredicate<T> filter, @Nullable int... types)
Supports asynchronous execution (see IgniteAsyncSupport).
waitForLocal in interface IgniteEventsfilter - Optional filtering predicate. Only if predicates evaluates to true will the event
end the wait.types - Types of the events to wait for. If not provided, all events will be passed to the filter.public <T extends Event> IgniteFuture<T> waitForLocalAsync(@Nullable @Nullable IgnitePredicate<T> filter, @Nullable int... types) throws IgniteException
waitForLocalAsync in interface IgniteEventsfilter - Optional filtering predicate. Only if predicates evaluates to true will the event
end the wait.types - Types of the events to wait for. If not provided, all events will be passed to the filter.IgniteException - If wait was interrupted.public <T extends Event> Collection<T> localQuery(IgnitePredicate<T> p, @Nullable int... types)
localQuery in interface IgniteEventsp - Predicate to filter events. All predicates must be satisfied for the
event to be returned.types - Event types to be queried.public void recordLocal(Event evt)
NOTE: all types in range from 1 to 1000 are reserved for
internal Ignite events and should not be used by user-defined events.
Attempt to record internal event with this method will cause IllegalArgumentException
to be thrown.
recordLocal in interface IgniteEventsevt - Locally generated event.public void localListen(IgnitePredicate<? extends Event> lsnr, int[] types)
localListen in interface IgniteEventslsnr - Predicate that is called on each received event. If predicate returns false,
it will be unregistered and will stop receiving events.types - Event types for which this listener will be notified.public boolean stopLocalListen(IgnitePredicate<? extends Event> lsnr, @Nullable int... types)
stopLocalListen in interface IgniteEventslsnr - Local event listener to remove.types - Types of events for which to remove listener. If not specified,
then listener will be removed for all types it was registered for.true if listener was removed, false otherwise.public void enableLocal(int[] types)
enableLocal in interface IgniteEventstypes - Events to enable.public void disableLocal(int[] types)
disableLocal in interface IgniteEventstypes - Events to disable.public int[] enabledEvents()
enabledEvents in interface IgniteEventspublic boolean isEnabled(int type)
isEnabled in interface IgniteEventstype - Event type.True if event of passed in type is enabled.protected IgniteEvents createAsyncInstance()
createAsyncInstance in class AsyncSupportAdapter<IgniteEvents>public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionprotected Object readResolve() throws ObjectStreamException
ObjectStreamException - Thrown in case of unmarshalling error.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.1 Release Date : December 20 2021