use of com.hazelcast.durableexecutor.DurableExecutorService in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceTest method testInvokeAll_WithTimeout.
@Test
public void testInvokeAll_WithTimeout() throws Exception {
DurableExecutorService service = client.getDurableExecutorService(randomString());
List<BasicTestCallable> callables = Collections.emptyList();
expectedException.expect(UnsupportedOperationException.class);
service.invokeAll(callables, 1, TimeUnit.SECONDS);
}
use of com.hazelcast.durableexecutor.DurableExecutorService 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);
}
}
use of com.hazelcast.durableexecutor.DurableExecutorService in project hazelcast by hazelcast.
the class ClientDurableRetrieveResultTest method testDisposeResult.
@Test
public void testDisposeResult() throws Exception {
String name = randomString();
String key = generateKeyOwnedBy(instance1);
DurableExecutorService executorService = client.getDurableExecutorService(name);
BasicTestCallable task = new BasicTestCallable();
DurableExecutorServiceFuture<String> future = executorService.submitToKeyOwner(task, key);
future.get();
executorService.disposeResult(future.getTaskId());
Future<Object> resultFuture = executorService.retrieveResult(future.getTaskId());
assertNull(resultFuture.get());
}
use of com.hazelcast.durableexecutor.DurableExecutorService in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceTest method testShutdownMultipleTimes.
@Test
public void testShutdownMultipleTimes() {
final DurableExecutorService service = client.getDurableExecutorService(randomString());
service.shutdownNow();
service.shutdown();
assertTrueEventually(new AssertTask() {
public void run() throws Exception {
assertTrue(service.isShutdown());
}
});
}
use of com.hazelcast.durableexecutor.DurableExecutorService in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceTest method testShutdownNow.
@Test
public void testShutdownNow() {
final DurableExecutorService service = client.getDurableExecutorService(randomString());
service.shutdownNow();
assertTrueEventually(new AssertTask() {
public void run() throws Exception {
assertTrue(service.isShutdown());
}
});
}
Aggregations