Search in sources :

Example 1 with NullCallable

use of com.hazelcast.client.test.executor.tasks.NullCallable in project hazelcast by hazelcast.

the class ClientExecutorServiceSubmitTest method submitCallableWithNullResultToAllMembers_withMultiExecutionCallback.

@Test
public void submitCallableWithNullResultToAllMembers_withMultiExecutionCallback() {
    IExecutorService service = client.getExecutorService(randomString());
    final CountDownLatch responseLatch = new CountDownLatch(CLUSTER_SIZE);
    final CountDownLatch completeLatch = new CountDownLatch(CLUSTER_SIZE);
    Callable callable = new NullCallable();
    service.submitToAllMembers(callable, new MultiExecutionCallback() {

        public void onResponse(Member member, Object value) {
            if (value == null) {
                responseLatch.countDown();
            }
        }

        public void onComplete(Map<Member, Object> values) {
            for (Member member : values.keySet()) {
                Object value = values.get(member);
                if (value == null) {
                    completeLatch.countDown();
                }
            }
        }
    });
    assertOpenEventually("responseLatch", responseLatch);
    assertOpenEventually("completeLatch", completeLatch);
}
Also used : MultiExecutionCallback(com.hazelcast.core.MultiExecutionCallback) NullCallable(com.hazelcast.client.test.executor.tasks.NullCallable) IExecutorService(com.hazelcast.core.IExecutorService) CountDownLatch(java.util.concurrent.CountDownLatch) Member(com.hazelcast.cluster.Member) NullCallable(com.hazelcast.client.test.executor.tasks.NullCallable) Callable(java.util.concurrent.Callable) AppendCallable(com.hazelcast.client.test.executor.tasks.AppendCallable) MapPutPartitionAwareCallable(com.hazelcast.client.test.executor.tasks.MapPutPartitionAwareCallable) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

AppendCallable (com.hazelcast.client.test.executor.tasks.AppendCallable)1 MapPutPartitionAwareCallable (com.hazelcast.client.test.executor.tasks.MapPutPartitionAwareCallable)1 NullCallable (com.hazelcast.client.test.executor.tasks.NullCallable)1 Member (com.hazelcast.cluster.Member)1 IExecutorService (com.hazelcast.core.IExecutorService)1 MultiExecutionCallback (com.hazelcast.core.MultiExecutionCallback)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Callable (java.util.concurrent.Callable)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Test (org.junit.Test)1