HCOLL-216 added a test for testPutLater

This commit is contained in:
Rob Austin
2014-11-24 15:17:09 +00:00
parent 1e87d6ba8a
commit 632eb7fe81
7 changed files with 105 additions and 15 deletions
@@ -385,7 +385,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, KI>,
}
@Override
public Future<V> getLater(K key) {
public Future<V> getLater(@NotNull K key) {
final V v = get(key);
return new Future<V>() {
@@ -416,6 +416,38 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, KI>,
};
}
@Override
public Future<V> putLater(@NotNull K key, @NotNull V value) {
final V v = put(key, value);
return new Future<V>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return true;
}
@Override
public V get() throws InterruptedException, ExecutionException {
return v;
}
@Override
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return v;
}
};
}
@NotNull
@Override
public WriteContext<K, V> acquireUsingLocked(@NotNull K key, @NotNull V usingValue) {