use of org.apache.cassandra.utils.concurrent.Promise in project cassandra by apache.
the class AsyncChannelPromiseTest method testTimeout.
@Test
public void testTimeout() {
final AtomicInteger initialListeners = new AtomicInteger();
List<Supplier<Promise<Void>>> suppliers = suppliers(initialListeners, true);
for (Supplier<Promise<Void>> supplier : suppliers) testOneTimeout(supplier.get());
Assert.assertEquals(0, initialListeners.get());
}
use of org.apache.cassandra.utils.concurrent.Promise in project cassandra by apache.
the class AsyncChannelPromiseTest method testFailure.
@Test
public void testFailure() {
final AtomicInteger initialListeners = new AtomicInteger();
List<Supplier<Promise<Void>>> suppliers = suppliers(initialListeners, true);
for (boolean tryOrSet : new boolean[] { false, true }) for (Throwable v : new Throwable[] { null, new NullPointerException() }) for (Supplier<Promise<Void>> supplier : suppliers) testOneFailure(supplier.get(), tryOrSet, v, null);
Assert.assertEquals(2 * 2 * 2, initialListeners.get());
}
Aggregations