use of com.hazelcast.executor.ExecutorServiceTestSupport.SleepingTask in project hazelcast by hazelcast.
the class ClientDurableRetrieveResultTest method testRetrieve_WhenOwnerMemberDown.
@Test
public void testRetrieve_WhenOwnerMemberDown() throws Exception {
String name = randomString();
String key = generateKeyOwnedBy(instance2);
DurableExecutorService executorService = client.getDurableExecutorService(name);
SleepingTask task = new SleepingTask(4);
long taskId = executorService.submitToKeyOwner(task, key).getTaskId();
instance2.shutdown();
Future<Boolean> future = executorService.retrieveResult(taskId);
assertTrue(future.get());
}
use of com.hazelcast.executor.ExecutorServiceTestSupport.SleepingTask in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceTest method test_whenRingBufferIsFull_thenThrowRejectedExecutionException.
@Test
public void test_whenRingBufferIsFull_thenThrowRejectedExecutionException() throws Exception {
String key = randomString();
DurableExecutorService service = client.getDurableExecutorService(SINGLE_TASK + randomString());
service.submitToKeyOwner(new SleepingTask(100), key);
DurableExecutorServiceFuture<String> future = service.submitToKeyOwner(new BasicTestCallable(), key);
expectedException.expect(new RootCauseMatcher(RejectedExecutionException.class));
future.get();
}
Aggregations