예제 #1
0
 public boolean remove(Data dataKey, Object testValue) {
   checkIfLoaded();
   Record record = records.get(dataKey);
   Object oldValue = null;
   boolean removed = false;
   if (record == null) {
     if (mapContainer.getStore() != null) {
       oldValue = mapContainer.getStore().load(mapService.toObject(dataKey));
     }
     if (oldValue == null) return false;
   } else {
     oldValue = record.getValue();
   }
   if (mapService.compare(name, testValue, oldValue)) {
     mapService.interceptRemove(name, oldValue);
     removeIndex(dataKey);
     mapStoreDelete(record, dataKey);
     // reduce size
     updateSizeEstimator(-calculateRecordSize(record));
     deleteRecord(dataKey);
     cancelAssociatedSchedulers(dataKey);
     removed = true;
   }
   return removed;
 }
예제 #2
0
 public Object remove(Data dataKey) {
   checkIfLoaded();
   Record record = records.get(dataKey);
   Object oldValue = null;
   if (record == null) {
     if (mapContainer.getStore() != null) {
       oldValue = mapContainer.getStore().load(mapService.toObject(dataKey));
       if (oldValue != null) {
         removeIndex(dataKey);
         mapStoreDelete(null, dataKey);
       }
     }
   } else {
     oldValue = record.getValue();
     oldValue = mapService.interceptRemove(name, oldValue);
     if (oldValue != null) {
       removeIndex(dataKey);
       mapStoreDelete(record, dataKey);
     }
     // reduce size
     updateSizeEstimator(-calculateRecordSize(record));
     deleteRecord(dataKey);
     cancelAssociatedSchedulers(dataKey);
   }
   return oldValue;
 }
예제 #3
0
 public Object evict(Data dataKey) {
   checkIfLoaded();
   Record record = records.get(dataKey);
   Object oldValue = null;
   if (record != null) {
     flush(dataKey);
     mapService.interceptRemove(name, record.getValue());
     oldValue = record.getValue();
     // reduce size
     updateSizeEstimator(-calculateRecordSize(record));
     deleteRecord(dataKey);
     removeIndex(dataKey);
     cancelAssociatedSchedulers(dataKey);
   }
   return oldValue;
 }