HCOLL-216 added removeLater

This commit is contained in:
Rob Austin
2014-11-25 14:27:25 +00:00
parent abcf1fabc4
commit 70656a83b9
7 changed files with 203 additions and 89 deletions
@@ -155,6 +155,18 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
});
}
@Override
public Future<V> removeLater(@NotNull final K key) {
return lazyExecutorService().submit(new Callable<V>() {
@Override
public V call() throws Exception {
V oldValue = StatelessChronicleMap.this.remove(key);
return oldValue;
}
});
}
private ExecutorService lazyExecutorService() {
@@ -485,7 +497,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
if (key == null)
throw new NullPointerException("key can not be null");
final long sizeLocation = (removeReturnsNull) ? writeEvent(REMOVE_WITHOUT_ACC) : writeEventAnSkip(REMOVE);
final long sizeLocation = removeReturnsNull ? writeEvent(REMOVE_WITHOUT_ACC) : writeEventAnSkip(REMOVE);
writeKey((K) key);