use of com.hazelcast.client.executor.tasks.GetMemberUuidTask in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMembers.
@Test
public void testSubmitCallableToMembers() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable<String> getUuidCallable = new GetMemberUuidTask();
Collection<Member> collection = server.getCluster().getMembers();
Map<Member, Future<String>> map = service.submitToMembers(getUuidCallable, collection);
for (Member member : map.keySet()) {
Future<String> result = map.get(member);
String uuid = result.get();
assertEquals(member.getUuid(), uuid);
}
}
use of com.hazelcast.client.executor.tasks.GetMemberUuidTask in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMembers_withMemberSelector.
@Test
public void testSubmitCallableToMembers_withMemberSelector() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable<String> getUuidCallable = new GetMemberUuidTask();
MemberSelector selectAll = new SelectAllMembers();
Map<Member, Future<String>> map = service.submitToMembers(getUuidCallable, selectAll);
for (Member member : map.keySet()) {
Future<String> result = map.get(member);
String uuid = result.get();
assertEquals(member.getUuid(), uuid);
}
}
use of com.hazelcast.client.executor.tasks.GetMemberUuidTask in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMember_withExecutionCallback.
@Test
public void testSubmitCallableToMember_withExecutionCallback() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable getUuidCallable = new GetMemberUuidTask();
Member member = server.getCluster().getLocalMember();
final CountDownLatch responseLatch = new CountDownLatch(1);
final AtomicReference<Object> result = new AtomicReference<Object>();
service.submitToMember(getUuidCallable, member, new ExecutionCallback() {
@Override
public void onResponse(Object response) {
result.set(response);
responseLatch.countDown();
}
@Override
public void onFailure(Throwable t) {
}
});
assertOpenEventually("responseLatch", responseLatch);
assertEquals(member.getUuid(), result.get());
}
use of com.hazelcast.client.executor.tasks.GetMemberUuidTask in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMember.
@Test
public void testSubmitCallableToMember() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable<String> getUuidCallable = new GetMemberUuidTask();
Member member = server.getCluster().getLocalMember();
Future<String> result = service.submitToMember(getUuidCallable, member);
assertEquals(member.getUuid(), result.get());
}
Aggregations