private void publishEntryEvent(Data key, Data previousValue, Data newValue) {
   final EntryEventType eventType =
       previousValue == null ? EntryEventType.ADDED : EntryEventType.UPDATED;
   final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
   final MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
   mapEventPublisher.publishEvent(
       getCallerAddress(), name, eventType, key, previousValue, newValue);
 }
 public void afterRun() {
   final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
   final MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
   mapServiceContext.interceptAfterPut(name, dataValue);
   eventType = getEventType();
   mapEventPublisher.publishEvent(
       getCallerAddress(), name, eventType, dataKey, dataOldValue, dataValue);
   invalidateNearCaches();
   publishWANReplicationEvent(mapServiceContext, mapEventPublisher);
   evict(false);
 }
  private void publishWANReplicationEvent(
      MapServiceContext mapServiceContext, MapEventPublisher mapEventPublisher) {
    if (mapContainer.getWanReplicationPublisher() == null
        || mapContainer.getWanMergePolicy() == null) {
      return;
    }

    Record record = recordStore.getRecord(dataKey);
    if (record == null) {
      return;
    }
    final Data valueConvertedData = mapServiceContext.toData(dataValue);
    final EntryView entryView =
        EntryViews.createSimpleEntryView(dataKey, valueConvertedData, record);
    mapEventPublisher.publishWanReplicationUpdate(name, entryView);
  }