Search in sources :

Example 6 with FailingCallable

use of com.hazelcast.client.executor.tasks.FailingCallable in project hazelcast by hazelcast.

the class ClientExecutorServiceTest method testSubmitFailingCallableException_withExecutionCallback.

@Test
public void testSubmitFailingCallableException_withExecutionCallback() throws ExecutionException, InterruptedException {
    IExecutorService service = client.getExecutorService(randomString());
    final CountDownLatch latch = new CountDownLatch(1);
    service.submit(new FailingCallable(), new ExecutionCallback<String>() {

        @Override
        public void onResponse(String response) {
        }

        @Override
        public void onFailure(Throwable t) {
            latch.countDown();
        }
    });
    assertTrue(latch.await(10, TimeUnit.SECONDS));
}
Also used : IExecutorService(com.hazelcast.core.IExecutorService) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) CountDownLatch(java.util.concurrent.CountDownLatch) FailingCallable(com.hazelcast.client.executor.tasks.FailingCallable) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

FailingCallable (com.hazelcast.client.executor.tasks.FailingCallable)6 HazelcastTestSupport.randomString (com.hazelcast.test.HazelcastTestSupport.randomString)6 ParallelTest (com.hazelcast.test.annotation.ParallelTest)6 QuickTest (com.hazelcast.test.annotation.QuickTest)6 Test (org.junit.Test)6 IExecutorService (com.hazelcast.core.IExecutorService)3 DurableExecutorService (com.hazelcast.durableexecutor.DurableExecutorService)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 RootCauseMatcher (com.hazelcast.util.RootCauseMatcher)1 ExecutionException (java.util.concurrent.ExecutionException)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1