private void updateTtl(Record record, long ttl) {
   if (ttl > 0) {
     mapService.scheduleTtlEviction(name, record, ttl);
   } else if (ttl == 0) {
     mapContainer.getTtlEvictionScheduler().cancel(record.getKey());
   }
 }
Exemple #2
0
 private void setDelays(MapContainer mapContainer, RecordInfo info, Data key, int extraDelay) {
   long deleteDelay = -1;
   long writeDelay = -1;
   long idleDelay;
   long ttlDelay;
   if (mapContainer.getMapStoreScheduler() != null) {
     final ScheduledEntry scheduledEntry = mapContainer.getMapStoreScheduler().get(key);
     if (scheduledEntry != null) {
       if (scheduledEntry.getValue() == null) {
         deleteDelay = extraDelay + findDelayMillis(scheduledEntry);
       } else {
         writeDelay = extraDelay + findDelayMillis(scheduledEntry);
       }
     }
   }
   idleDelay = getDelay(mapContainer.getIdleEvictionScheduler(), key, extraDelay);
   ttlDelay = getDelay(mapContainer.getTtlEvictionScheduler(), key, extraDelay);
   // set delays.
   info.setMapStoreDeleteDelayMillis(deleteDelay);
   info.setMapStoreWriteDelayMillis(writeDelay);
   info.setIdleDelayMillis(idleDelay);
   info.setTtlDelayMillis(ttlDelay);
 }
 private void cancelAssociatedSchedulers(Data key) {
   mapContainer.getIdleEvictionScheduler().cancel(key);
   mapContainer.getTtlEvictionScheduler().cancel(key);
 }