use of com.hazelcast.core.MemberSelector in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecuteOnMembers_withSelector.
@Test
public void testExecuteOnMembers_withSelector() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
MemberSelector selector = new SelectAllMembers();
service.executeOnMembers(new MapPutRunnable(mapName), selector);
IMap map = client.getMap(mapName);
assertSizeEventually(CLUSTER_SIZE, map);
}
use of com.hazelcast.core.MemberSelector in project hazelcast by hazelcast.
the class SingleNodeTest method alwaysFalseMemberSelector_expectRejection.
@Test(expected = RejectedExecutionException.class)
public void alwaysFalseMemberSelector_expectRejection() {
HazelcastInstanceAwareRunnable task = new HazelcastInstanceAwareRunnable();
executor.execute(task, new MemberSelector() {
@Override
public boolean select(Member member) {
return false;
}
});
}
use of com.hazelcast.core.MemberSelector in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecuteOnMembers_whenSelectorNull.
@Test(expected = IllegalArgumentException.class)
public void testExecuteOnMembers_whenSelectorNull() {
IExecutorService service = client.getExecutorService(randomString());
MemberSelector selector = null;
service.executeOnMembers(new MapPutRunnable("task"), selector);
}
use of com.hazelcast.core.MemberSelector in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method submitRunnableToMembers_withExecutionCallback.
@Test
public void submitRunnableToMembers_withExecutionCallback() {
IExecutorService service = client.getExecutorService(randomString());
final CountDownLatch responseLatch = new CountDownLatch(CLUSTER_SIZE);
final CountDownLatch completeLatch = new CountDownLatch(1);
String mapName = randomString();
Runnable runnable = new MapPutRunnable(mapName);
MemberSelector selector = new SelectAllMembers();
service.submitToMembers(runnable, selector, new MultiExecutionCallback() {
public void onResponse(Member member, Object value) {
responseLatch.countDown();
}
public void onComplete(Map<Member, Object> values) {
completeLatch.countDown();
}
});
IMap map = client.getMap(mapName);
assertOpenEventually("responseLatch", responseLatch);
assertOpenEventually("completeLatch", completeLatch);
assertEquals(CLUSTER_SIZE, map.size());
}
use of com.hazelcast.core.MemberSelector in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testExecute_withNoMemberSelected.
@Test(expected = RejectedExecutionException.class)
public void testExecute_withNoMemberSelected() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
MemberSelector selector = new SelectNoMembers();
service.execute(new MapPutRunnable(mapName), selector);
}
Aggregations