use of com.hazelcast.core.EntryEventType in project hazelcast by hazelcast.
the class QueryCacheEventPublisher method convertQueryCacheEventDataOrNull.
private QueryCacheEventData convertQueryCacheEventDataOrNull(PartitionAccumulatorRegistry registry, Data dataKey, Data dataNewValue, Data dataOldValue, int eventTypeId, int partitionId) {
EventFilter eventFilter = registry.getEventFilter();
EntryEventType eventType = EntryEventType.getByType(eventTypeId);
// filtering strategy
if (filteringStrategy instanceof DefaultEntryEventFilteringStrategy) {
eventType = getCQCEventTypeOrNull(eventType, eventFilter, dataKey, dataNewValue, dataOldValue);
} else {
int producedEventTypeId = filteringStrategy.doFilter(eventFilter, dataKey, dataOldValue, dataNewValue, eventType, null);
if (producedEventTypeId == FilteringStrategy.FILTER_DOES_NOT_MATCH) {
eventType = null;
} else {
eventType = EntryEventType.getByType(producedEventTypeId);
}
}
if (eventType == null) {
return null;
}
boolean includeValue = isIncludeValue(eventFilter);
return newQueryCacheEventDataBuilder(includeValue).withPartitionId(partitionId).withDataKey(dataKey).withDataNewValue(dataNewValue).withEventType(eventType.getType()).withDataOldValue(dataOldValue).withSerializationService((serializationService)).build();
}
use of com.hazelcast.core.EntryEventType in project hazelcast by hazelcast.
the class PutFromLoadAllOperation method publishEntryEvent.
private void publishEntryEvent(Data key, Object previousValue, Object newValue) {
final EntryEventType eventType = previousValue == null ? EntryEventType.ADDED : EntryEventType.UPDATED;
mapEventPublisher.publishEvent(getCallerAddress(), name, eventType, key, previousValue, newValue);
}
use of com.hazelcast.core.EntryEventType in project hazelcast by hazelcast.
the class MapListenerFlagOperator method setAndGetListenerFlags.
/**
* Sets and gets flags of implemented listener interfaces of a {@link com.hazelcast.map.listener.MapListener MapListener}.
*/
public static int setAndGetListenerFlags(ListenerAdapter listenerAdapter) {
InternalMapListenerAdapter internalMapListenerAdapter = (InternalMapListenerAdapter) listenerAdapter;
ListenerAdapter[] listenerAdapters = internalMapListenerAdapter.getListenerAdapters();
EntryEventType[] values = EntryEventType.values();
int listenerFlags = 0;
for (EntryEventType eventType : values) {
ListenerAdapter definedAdapter = listenerAdapters[eventType.ordinal()];
if (definedAdapter != null) {
listenerFlags = listenerFlags | eventType.getType();
}
}
return listenerFlags;
}
use of com.hazelcast.core.EntryEventType in project hazelcast by hazelcast.
the class QueryCacheEventPublisher method convertQueryCacheEventDataOrNull.
private QueryCacheEventData convertQueryCacheEventDataOrNull(PartitionAccumulatorRegistry registry, Data dataKey, Data dataNewValue, Data dataOldValue, int eventTypeId, int partitionId, String mapName) {
EventFilter eventFilter = registry.getEventFilter();
EntryEventType eventType = EntryEventType.getByType(eventTypeId);
// filtering strategy
if (filteringStrategy instanceof DefaultEntryEventFilteringStrategy) {
eventType = getCQCEventTypeOrNull(eventType, eventFilter, dataKey, dataNewValue, dataOldValue, mapName);
} else {
int producedEventTypeId = filteringStrategy.doFilter(eventFilter, dataKey, dataOldValue, dataNewValue, eventType, mapName);
if (producedEventTypeId == FilteringStrategy.FILTER_DOES_NOT_MATCH) {
eventType = null;
} else {
eventType = EntryEventType.getByType(producedEventTypeId);
}
}
if (eventType == null) {
return null;
}
boolean includeValue = isIncludeValue(eventFilter);
return newQueryCacheEventDataBuilder(includeValue).withPartitionId(partitionId).withDataKey(dataKey).withDataNewValue(dataNewValue).withEventType(eventType.getType()).withDataOldValue(dataOldValue).withSerializationService((serializationService)).build();
}
use of com.hazelcast.core.EntryEventType in project hazelcast by hazelcast.
the class DefaultRecordStore method putFromLoadInternal.
private Object putFromLoadInternal(Data key, Object newValue, long ttl, long maxIdle, boolean backup, Address callerAddress) {
checkKeyAndValue(key, newValue);
if (shouldEvict()) {
return null;
}
long now = getNow();
Object oldValue = putInternal(key, newValue, ttl, maxIdle, UNSET, now, false, false, false, false, false, true, null, false, false, null, null, false, backup);
if (!backup && mapEventPublisher.hasEventListener(name)) {
Record record = getRecord(key);
EntryEventType entryEventType = oldValue == null ? LOADED : UPDATED;
mapEventPublisher.publishEvent(callerAddress, name, entryEventType, key, oldValue, record.getValue());
}
return oldValue;
}
Aggregations