Search in sources :

Example 1 with DataAwareEntryEvent

use of com.hazelcast.map.impl.DataAwareEntryEvent 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);
}
Also used : LocalEntryEventData(com.hazelcast.map.impl.querycache.event.LocalEntryEventData) MapEvent(com.hazelcast.core.MapEvent) IMapEvent(com.hazelcast.core.IMapEvent) EventLostEvent(com.hazelcast.map.EventLostEvent) Data(com.hazelcast.nio.serialization.Data) LocalCacheWideEventData(com.hazelcast.map.impl.querycache.event.LocalCacheWideEventData) LocalEntryEventData(com.hazelcast.map.impl.querycache.event.LocalEntryEventData) EventData(com.hazelcast.map.impl.event.EventData) DataAwareEntryEvent(com.hazelcast.map.impl.DataAwareEntryEvent) LocalCacheWideEventData(com.hazelcast.map.impl.querycache.event.LocalCacheWideEventData)

Aggregations

IMapEvent (com.hazelcast.core.IMapEvent)1 MapEvent (com.hazelcast.core.MapEvent)1 EventLostEvent (com.hazelcast.map.EventLostEvent)1 DataAwareEntryEvent (com.hazelcast.map.impl.DataAwareEntryEvent)1 EventData (com.hazelcast.map.impl.event.EventData)1 LocalCacheWideEventData (com.hazelcast.map.impl.querycache.event.LocalCacheWideEventData)1 LocalEntryEventData (com.hazelcast.map.impl.querycache.event.LocalEntryEventData)1 Data (com.hazelcast.nio.serialization.Data)1