919293949596979899100101
initC2(key); Future<Void> f2 = c1.putAllAsync(Collections.singletonMap(key, v3)); assert f2 != null; assert !f2.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); assert !f2.isCancelled(); assert f2.get() == null; assert f2.isDone(); assertInvalidated(key, v3);
112113114115116117118119120121122
initC2(key); f = c1.removeAsync(key); assert f != null; assert !f.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); assert !f.isCancelled(); assert f.get().equals(v3); assert f.isDone(); assertInvalidated(key, null);
124125126127128129130131132133134
initC2(key); f = c1.putIfAbsentAsync(key, v4); assert f != null; assert !f.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); assert !f.isCancelled(); assert f.get() == null; assert f.isDone(); assertInvalidated(key, v4);
143144145146147148149150151152153
f3 = c1.removeAsync(key, v4); assert f3 != null; assert !f3.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); assert !f3.isCancelled(); assert f3.get().equals(true); assert f3.isDone(); assertInvalidated(key, null);
158159160161162163164165166167168
assert !f.isCancelled(); assert f.get() == null; assert f.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); resetListeners(); c1.put(key, v); asyncWait(); initC2(key);
168169170171172173174175176177178
initC2(key); f = c1.replaceAsync(key, v5); assert f != null; assert !f.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); assert !f.isCancelled(); assert f.get().equals(v); assert f.isDone(); assertInvalidated(key, v5);
188189190191192193194195196197198
f3 = c1.replaceAsync(key, v5, v6); assert f3 != null; assert !f3.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); assert !f3.isCancelled(); assert f3.get().equals(true); assert f3.isDone(); assertInvalidated(key, v6); }
6667686970717273747576
Future<String> f = c1.putAsync(key, v); System.out.println("Future is of type " + f.getClass().getName()); assert f != null; assert !f.isDone(); assert c2.get(key) == null; key.allowSerialization(); assert !f.isCancelled(); assert f.get() == null; assert f.isDone(); assertOnAllCaches(key, v);
7677787980818283848586
f = c1.putAsync(key, v2); assert f != null; assert !f.isDone(); assert c2.get(key).equals(v); key.allowSerialization(); assert !f.isCancelled(); assert f.get().equals(v); assert f.isDone(); assertOnAllCaches(key, v2);
8788899091929394959697
// putAll Future<Void> f2 = c1.putAllAsync(Collections.singletonMap(key, v3)); assert f2 != null; assert !f2.isDone(); assert c2.get(key).equals(v2); key.allowSerialization(); assert !f2.isCancelled(); assert f2.get() == null; assert f2.isDone(); assertOnAllCaches(key, v3);