use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method submitCallable_withExecutionCallback.
@Test
public void submitCallable_withExecutionCallback() {
IExecutorService service = client.getExecutorService(randomString());
final CountDownLatch responseLatch = new CountDownLatch(1);
String msg = randomString();
Callable runnable = new AppendCallable(msg);
MemberSelector selector = new SelectAllMembers();
final AtomicReference<Object> result = new AtomicReference<Object>();
service.submit(runnable, selector, new ExecutionCallback() {
public void onResponse(Object response) {
result.set(response);
responseLatch.countDown();
}
public void onFailure(Throwable t) {
}
});
assertOpenEventually("responseLatch", responseLatch);
assertEquals(msg + AppendCallable.APPENDAGE, result.get());
}
use of com.hazelcast.cluster.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);
}
use of com.hazelcast.cluster.MemberSelector in project sonarqube by SonarSource.
the class AppNodesClusterHostsConsistency method check.
public void check() {
try {
MemberSelector selector = MemberSelectors.and(NON_LOCAL_MEMBER_SELECTOR, HazelcastMemberSelectors.selectorForProcessIds(ProcessId.APP));
hzMember.callAsync(AppNodesClusterHostsConsistency::getConfiguredClusterHosts, selector, new Callback());
} catch (RejectedExecutionException e) {
// no other node in the cluster yet, ignore
}
}
use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.
the class PartitionStateManager method createMemberGroups.
private Collection<MemberGroup> createMemberGroups(final Set<Member> excludedMembers) {
MemberSelector exclude = member -> !excludedMembers.contains(member);
final MemberSelector selector = MemberSelectors.and(DATA_MEMBER_SELECTOR, exclude);
final Collection<Member> members = node.getClusterService().getMembers(selector);
return memberGroupFactory.createMemberGroups(members);
}
use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.
the class MemberSelectorsTest method testAndMemberSelector3.
@Test
public void testAndMemberSelector3() {
when(member.localMember()).thenReturn(true);
when(member.isLiteMember()).thenReturn(true);
MemberSelector selector = MemberSelectors.and(LOCAL_MEMBER_SELECTOR, LITE_MEMBER_SELECTOR);
assertTrue(selector.select(member));
verify(member).localMember();
verify(member).isLiteMember();
}
Aggregations