Exemple #1
0
 private long getDelay(EntryTaskScheduler entryTaskScheduler, Data key, int extraDelay) {
   if (entryTaskScheduler != null) {
     final ScheduledEntry entry = entryTaskScheduler.get(key);
     if (entry != null) {
       return extraDelay + findDelayMillis(entry);
     }
   }
   return -1;
 }
 private void flush(Data key) {
   checkIfLoaded();
   EntryTaskScheduler writeScheduler = mapContainer.getMapStoreScheduler();
   Set<Data> keys = new HashSet<Data>(1);
   keys.add(key);
   if (writeScheduler != null) {
     Set<Data> processedKeys = writeScheduler.flush(keys);
     for (Data pkey : processedKeys) {
       records.get(pkey).onStore();
     }
   }
   EntryTaskScheduler deleteScheduler = mapContainer.getMapStoreScheduler();
   if (deleteScheduler != null) {
     if (toBeRemovedKeys.contains(key)) {
       deleteScheduler.flush(keys);
       toBeRemovedKeys.remove(key);
     }
   }
 }
 public void flush() {
   checkIfLoaded();
   Set<Data> keys = new HashSet<Data>();
   for (Record record : records.values()) {
     keys.add(record.getKey());
   }
   EntryTaskScheduler writeScheduler = mapContainer.getMapStoreScheduler();
   if (writeScheduler != null) {
     Set<Data> processedKeys = writeScheduler.flush(keys);
     for (Data key : processedKeys) {
       records.get(key).onStore();
     }
   }
   EntryTaskScheduler deleteScheduler = mapContainer.getMapStoreScheduler();
   if (deleteScheduler != null) {
     deleteScheduler.flush(toBeRemovedKeys);
     toBeRemovedKeys.clear();
   }
 }
 public void clear() {
   locks.clear();
   entryTaskScheduler.cancelAll();
 }
 void cancelEviction(Data key) {
   entryTaskScheduler.cancel(key);
 }
 void scheduleEviction(Data key, int version, long leaseTime) {
   entryTaskScheduler.schedule(leaseTime, key, version);
 }