use of com.hazelcast.map.impl.event.MapEventPublisher in project hazelcast by hazelcast.
the class MapEvictAllMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
MapService mapService = getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
int evictedTotal = 0;
for (Object result : map.values()) {
Integer size = (Integer) mapServiceContext.toObject(result);
evictedTotal += size;
}
if (evictedTotal > 0) {
Address thisAddress = mapServiceContext.getNodeEngine().getThisAddress();
MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
mapEventPublisher.publishMapEvent(thisAddress, parameters.name, EVICT_ALL, evictedTotal);
}
return null;
}
use of com.hazelcast.map.impl.event.MapEventPublisher in project hazelcast by hazelcast.
the class EntryBackupOperation method publishWanReplicationEvent.
private void publishWanReplicationEvent(EntryEventType eventType) {
final MapContainer mapContainer = this.mapContainer;
if (!mapContainer.isWanReplicationEnabled()) {
return;
}
final MapEventPublisher mapEventPublisher = mapContainer.getMapServiceContext().getMapEventPublisher();
final Data key = dataKey;
if (EntryEventType.REMOVED == eventType) {
mapEventPublisher.publishWanReplicationRemoveBackup(name, key, Clock.currentTimeMillis());
} else {
final Record record = recordStore.getRecord(key);
if (record != null) {
dataValue = mapContainer.getMapServiceContext().toData(dataValue);
final EntryView entryView = createSimpleEntryView(key, dataValue, record);
mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
}
}
}
use of com.hazelcast.map.impl.event.MapEventPublisher in project hazelcast by hazelcast.
the class MapProxySupport method publishMapEvent.
private void publishMapEvent(int numberOfAffectedEntries, EntryEventType eventType) {
MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
mapEventPublisher.publishMapEvent(thisAddress, name, eventType, numberOfAffectedEntries);
}
use of com.hazelcast.map.impl.event.MapEventPublisher in project hazelcast by hazelcast.
the class PutFromLoadAllOperation method publishWanReplicationEvent.
private void publishWanReplicationEvent(Data key, Object value, Record record) {
if (record == null || !mapContainer.isWanReplicationEnabled()) {
return;
}
MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
value = mapServiceContext.toData(value);
EntryView entryView = EntryViews.createSimpleEntryView(key, value, record);
mapEventPublisher.publishWanReplicationUpdate(name, entryView);
}
use of com.hazelcast.map.impl.event.MapEventPublisher in project hazelcast by hazelcast.
the class MapClearMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
int clearedTotal = 0;
for (Object affectedEntries : map.values()) {
clearedTotal += (Integer) affectedEntries;
}
MapService service = getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = service.getMapServiceContext();
if (clearedTotal > 0) {
Address thisAddress = nodeEngine.getThisAddress();
MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
mapEventPublisher.publishMapEvent(thisAddress, parameters.name, CLEAR_ALL, clearedTotal);
}
return null;
}
Aggregations