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();
   }
 }