use of com.hazelcast.durableexecutor.StaleTaskIdException in project hazelcast by hazelcast.
the class ClientDurableRetrieveResultTest method testRetrieve_WhenResultOverwritten.
@Test
public void testRetrieve_WhenResultOverwritten() throws Exception {
String name = randomString();
DurableExecutorService executorService = client.getDurableExecutorService(name);
DurableExecutorServiceFuture<String> future = executorService.submitToKeyOwner(new BasicTestCallable(), name);
long taskId = future.getTaskId();
future.get();
for (int i = 0; i < DEFAULT_RING_BUFFER_CAPACITY; i++) {
executorService.submitToKeyOwner(new BasicTestCallable(), name);
}
Future<Object> resultFuture = executorService.retrieveResult(taskId);
try {
resultFuture.get();
fail();
} catch (ExecutionException e) {
assertTrue(e.getCause() instanceof StaleTaskIdException);
}
}
Aggregations