Exemplo n.º 1
0
 public void run() {
   backupRecordInfos = new ArrayList<RecordInfo>();
   backupEntrySet = new ArrayList<Map.Entry<Data, Data>>();
   int partitionId = getPartitionId();
   final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
   RecordStore recordStore = mapServiceContext.getRecordStore(partitionId, name);
   Set<Map.Entry<Data, Data>> entries = entrySet.getEntrySet();
   InternalPartitionService partitionService = getNodeEngine().getPartitionService();
   Set<Data> keysToInvalidate = new HashSet<Data>();
   for (Map.Entry<Data, Data> entry : entries) {
     Data dataKey = entry.getKey();
     Data dataValue = entry.getValue();
     if (partitionId == partitionService.getPartitionId(dataKey)) {
       Data dataOldValue = null;
       if (initialLoad) {
         recordStore.putFromLoad(dataKey, dataValue, -1);
       } else {
         dataOldValue = mapServiceContext.toData(recordStore.put(dataKey, dataValue, -1));
       }
       mapServiceContext.interceptAfterPut(name, dataValue);
       EntryEventType eventType =
           dataOldValue == null ? EntryEventType.ADDED : EntryEventType.UPDATED;
       final MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
       mapEventPublisher.publishEvent(
           getCallerAddress(), name, eventType, dataKey, dataOldValue, dataValue);
       keysToInvalidate.add(dataKey);
       if (mapContainer.getWanReplicationPublisher() != null
           && mapContainer.getWanMergePolicy() != null) {
         Record record = recordStore.getRecord(dataKey);
         final Data dataValueAsData = mapServiceContext.toData(dataValue);
         final EntryView entryView =
             EntryViews.createSimpleEntryView(dataKey, dataValueAsData, record);
         mapEventPublisher.publishWanReplicationUpdate(name, entryView);
       }
       backupEntrySet.add(entry);
       RecordInfo replicationInfo = Records.buildRecordInfo(recordStore.getRecord(dataKey));
       backupRecordInfos.add(replicationInfo);
     }
   }
   invalidateNearCaches(keysToInvalidate);
 }
Exemplo n.º 2
0
 public void run() {
   MapService mapService = getService();
   int partitionId = getPartitionId();
   RecordStore recordStore = mapService.getRecordStore(partitionId, name);
   Record record = recordStore.getRecord(dataKey);
   if (record != null) {
     updateSizeEstimator(-calculateRecordSize(record));
     recordStore.deleteRecord(dataKey);
   }
   if (unlockKey) {
     recordStore.forceUnlock(dataKey);
   }
 }