public class MapEventPublisherImpl extends Object implements MapEventPublisher
| Modifier and Type | Field and Description |
|---|---|
protected EventService |
eventService |
protected FilteringStrategy |
filteringStrategy |
static HazelcastProperty |
LISTENER_WITH_PREDICATE_PRODUCES_NATURAL_EVENT_TYPES
When
true, enables processing of entry events for listeners with predicates to fit with "query cache" concept:
for example when the original event indicates an update from an old value that does not match the predicate to a new value
that does match, then the entry listener will be notified with an ADDED event. |
protected MapServiceContext |
mapServiceContext |
protected NodeEngine |
nodeEngine |
protected QueryCacheEventPublisher |
queryCacheEventPublisher |
protected SerializationService |
serializationService |
| Constructor and Description |
|---|
MapEventPublisherImpl(MapServiceContext mapServiceContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventToQueryCache(Object eventData)
Notifies
QueryCache subscribers directly, without publishing an event to
other map listeners. |
protected Collection<EventRegistration> |
getRegistrations(String mapName)
Return all listener registrations for the map with
mapName. |
boolean |
hasEventListener(String mapName)
Returns
true if there is at least one listener registered for the specified mapName. |
void |
hintMapEvent(Address caller,
String mapName,
EntryEventType eventType,
int numberOfEntriesAffected,
int partitionId)
Only gives a hint which indicates that a map-wide operation has just been executed on this partition.
|
protected void |
postPublishEvent(Collection<EntryEventData> eventDataIncludingValues,
Collection<EntryEventData> eventDataExcludingValues)
Hook for actions to perform after any of
publishEvent(com.hazelcast.nio.Address, java.lang.String, com.hazelcast.core.EntryEventType, com.hazelcast.nio.serialization.Data, java.lang.Object, java.lang.Object) methods is executed and if there
were any registrations for the event. |
void |
publishEvent(Address caller,
String mapName,
EntryEventType eventType,
Data dataKey,
Object dataOldValue,
Object dataValue)
Publish an event to the event subsystem.
|
void |
publishEvent(Address caller,
String mapName,
EntryEventType eventType,
Data dataKey,
Object oldValue,
Object value,
Object mergingValue)
Publish an event to the event subsystem.
|
protected void |
publishEventInternal(Collection<EventRegistration> registrations,
Object eventData,
int orderKey) |
void |
publishMapEvent(Address caller,
String mapName,
EntryEventType eventType,
int numberOfEntriesAffected) |
void |
publishMapPartitionLostEvent(Address caller,
String mapName,
int partitionId) |
protected void |
publishWanReplicationEventInternal(String mapName,
ReplicationEventObject event)
Publishes the
event to the WanReplicationPublisher configured for this map. |
void |
publishWanReplicationRemove(String mapName,
Data key,
long removeTime)
Notifies the WAN subsystem of a map entry removal on a replica owner.
|
void |
publishWanReplicationRemoveBackup(String mapName,
Data key,
long removeTime)
Notifies the WAN subsystem of a map entry removal on a backup replica.
|
void |
publishWanReplicationUpdate(String mapName,
EntryView<Data,Data> entryView)
Notifies the WAN subsystem of a map update on a replica owner.
|
void |
publishWanReplicationUpdateBackup(String mapName,
EntryView entryView)
Notifies the WAN subsystem of a map update on a backup replica.
|
public static final HazelcastProperty LISTENER_WITH_PREDICATE_PRODUCES_NATURAL_EVENT_TYPES
true, enables processing of entry events for listeners with predicates to fit with "query cache" concept:
for example when the original event indicates an update from an old value that does not match the predicate to a new value
that does match, then the entry listener will be notified with an ADDED event.
This affects only map listeners with predicates and the way entry updates are handled. Put/remove operations are not
affected, neither are listeners without predicates.
Default value is false, to maintain compatible behavior with previous Hazelcast versions.protected final MapServiceContext mapServiceContext
protected final NodeEngine nodeEngine
protected final SerializationService serializationService
protected final EventService eventService
protected final FilteringStrategy filteringStrategy
protected final QueryCacheEventPublisher queryCacheEventPublisher
public MapEventPublisherImpl(MapServiceContext mapServiceContext)
public void publishWanReplicationUpdate(String mapName, EntryView<Data,Data> entryView)
MapEventPublisherpublishWanReplicationUpdate in interface MapEventPublishermapName - the map nameentryView - the updated entrypublic void publishWanReplicationRemove(String mapName, Data key, long removeTime)
MapEventPublisherpublishWanReplicationRemove in interface MapEventPublishermapName - the map namekey - the key of the removed entryremoveTime - the clock time for the remove eventClock.currentTimeMillis()public void publishWanReplicationUpdateBackup(String mapName, EntryView entryView)
MapEventPublisherpublishWanReplicationUpdateBackup in interface MapEventPublishermapName - the map nameentryView - the updated entrypublic void publishWanReplicationRemoveBackup(String mapName, Data key, long removeTime)
MapEventPublisherpublishWanReplicationRemoveBackup in interface MapEventPublishermapName - the map namekey - the key of the removed entryremoveTime - the clock time for the remove eventClock.currentTimeMillis()public void publishMapEvent(Address caller, String mapName, EntryEventType eventType, int numberOfEntriesAffected)
publishMapEvent in interface MapEventPublisherpublic void publishEvent(Address caller, String mapName, EntryEventType eventType, Data dataKey, Object dataOldValue, Object dataValue)
MapEventPublisherpublishEvent in interface MapEventPublishercaller - the address of the caller that caused the eventmapName - the map nameeventType - the event typedataKey - the key of the event map entrydataOldValue - the old value of the map entrydataValue - the new value of the map entrypublic void publishEvent(Address caller, String mapName, EntryEventType eventType, Data dataKey, Object oldValue, Object value, Object mergingValue)
MapEventPublisherpublishEvent in interface MapEventPublishercaller - the address of the caller that caused the eventmapName - the map nameeventType - the event typedataKey - the key of the event map entryoldValue - the old value of the map entryvalue - the new value of the map entrymergingValue - the value used when performing a merge operation in case of a EntryEventType.MERGED event.
This value together with the old value produced the new value.protected void postPublishEvent(Collection<EntryEventData> eventDataIncludingValues, Collection<EntryEventData> eventDataExcludingValues)
publishEvent(com.hazelcast.nio.Address, java.lang.String, com.hazelcast.core.EntryEventType, com.hazelcast.nio.serialization.Data, java.lang.Object, java.lang.Object) methods is executed and if there
were any registrations for the event.
This method will be invoked once per unique EntryEventData generated by publishEvent,
regardless of the number of registrations on which the event is published.eventDataIncludingValues - the event data including all of the entry values (old, new, merging)eventDataExcludingValues - the event data without entry valuespublic void publishMapPartitionLostEvent(Address caller, String mapName, int partitionId)
publishMapPartitionLostEvent in interface MapEventPublisherpublic void hintMapEvent(Address caller, String mapName, EntryEventType eventType, int numberOfEntriesAffected, int partitionId)
MapEventPublisherhintMapEvent in interface MapEventPublisherpublic void addEventToQueryCache(Object eventData)
MapEventPublisherQueryCache subscribers directly, without publishing an event to
other map listeners. This is necessary in certain cases, such as when loading entries into a map.addEventToQueryCache in interface MapEventPublishereventData - the event to publish to query cachespublic boolean hasEventListener(String mapName)
MapEventPublishertrue if there is at least one listener registered for the specified mapName.hasEventListener in interface MapEventPublisherprotected Collection<EventRegistration> getRegistrations(String mapName)
mapName.mapName - the map nameprotected void publishEventInternal(Collection<EventRegistration> registrations, Object eventData, int orderKey)
protected void publishWanReplicationEventInternal(String mapName, ReplicationEventObject event)
event to the WanReplicationPublisher configured for this map.mapName - the map nameevent - the eventCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.