use of com.hazelcast.core.IMapEvent in project hazelcast by hazelcast.
the class MapEventPublishingService method dispatchLocalEventData.
/**
* Dispatches an event-data to {@link com.hazelcast.map.QueryCache QueryCache} listeners on this local
* node.
*
* @param eventData {@link EventData} to be dispatched
* @param listener the listener which the event will be dispatched from
*/
private void dispatchLocalEventData(EventData eventData, ListenerAdapter listener) {
IMapEvent event = createIMapEvent(eventData, null, nodeEngine.getLocalMember(), serializationService);
listener.onEvent(event);
}
use of com.hazelcast.core.IMapEvent in project hazelcast by hazelcast.
the class EventPublisherHelper method createIMapEvent.
public static IMapEvent createIMapEvent(EventData eventData, EventFilter filter, Member member, SerializationService serializationService) {
String source = eventData.getSource();
int eventType = eventData.getEventType();
if (eventType == EventLostEvent.EVENT_TYPE) {
LocalEntryEventData localEventData = (LocalEntryEventData) eventData;
int partitionId = localEventData.getPartitionId();
return new EventLostEvent(source, null, partitionId);
}
if (eventType == EntryEventType.CLEAR_ALL.getType() || eventType == EntryEventType.EVICT_ALL.getType()) {
LocalCacheWideEventData localCacheWideEventData = (LocalCacheWideEventData) eventData;
int numberOfEntriesAffected = localCacheWideEventData.getNumberOfEntriesAffected();
return new MapEvent(source, null, eventType, numberOfEntriesAffected);
}
LocalEntryEventData localEntryEventData = (LocalEntryEventData) eventData;
Data dataKey = localEntryEventData.getKeyData();
Data dataNewValue = localEntryEventData.getValueData();
Data dataOldValue = localEntryEventData.getOldValueData();
boolean includeValue = isIncludeValue(filter);
return new DataAwareEntryEvent(member, eventType, source, dataKey, (includeValue ? dataNewValue : null), (includeValue ? dataOldValue : null), null, serializationService);
}
use of com.hazelcast.core.IMapEvent in project hazelcast by hazelcast.
the class PostJoinMapOperation method createQueryCaches.
private void createQueryCaches() {
MapService mapService = getService();
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
PublisherContext publisherContext = queryCacheContext.getPublisherContext();
MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
for (AccumulatorInfo info : infoList) {
addAccumulatorInfo(queryCacheContext, info);
PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrCreate(info.getMapName());
publisherRegistry.getOrCreate(info.getCacheName());
// marker listener.
mapServiceContext.addLocalListenerAdapter(new ListenerAdapter<IMapEvent>() {
@Override
public void onEvent(IMapEvent event) {
}
}, info.getMapName());
}
}
Aggregations