use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testGetFutureAfterCancel.
@Test(expected = CancellationException.class)
public void testGetFutureAfterCancel() throws InterruptedException, ExecutionException, TimeoutException {
IExecutorService service = client.getExecutorService(randomString());
CancellationAwareTask task = new CancellationAwareTask(Long.MAX_VALUE);
Future future = service.submit(task);
try {
future.get(1, TimeUnit.SECONDS);
} catch (TimeoutException ignored) {
}
future.cancel(true);
future.get();
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testSubmitFailingCallableReasonExceptionCause.
@Test(expected = IllegalStateException.class)
public void testSubmitFailingCallableReasonExceptionCause() throws Throwable {
IExecutorService service = client.getExecutorService(randomString());
Future<String> failingFuture = service.submit(new FailingCallable());
try {
failingFuture.get();
} catch (ExecutionException e) {
throw e.getCause();
}
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testShutdownMultipleTimes.
@Test
public void testShutdownMultipleTimes() throws InterruptedException, ExecutionException, TimeoutException {
final IExecutorService service = client.getExecutorService(randomString());
service.shutdownNow();
service.shutdown();
assertTrueEventually(new AssertTask() {
public void run() throws Exception {
assertTrue(service.isShutdown());
}
});
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testCallableSerializedOnce_submitToAddress.
@Test
public void testCallableSerializedOnce_submitToAddress() throws ExecutionException, InterruptedException {
String name = randomString();
IExecutorService service = client.getExecutorService(name);
SerializedCounterCallable counterCallable = new SerializedCounterCallable();
Future future = service.submitToMember(counterCallable, instance.getCluster().getLocalMember());
assertEquals(2, future.get());
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testIsShutdown.
@Test
public void testIsShutdown() throws InterruptedException, ExecutionException, TimeoutException {
IExecutorService service = client.getExecutorService(randomString());
assertFalse(service.isShutdown());
}
Aggregations