Search in sources :

Example 31 with ClusterService

use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.

the class ClusterServiceMemberListTest method verifyMembersFromDataMember.

private void verifyMembersFromDataMember(final HazelcastInstance instance) {
    final Member localMember = getLocalMember(instance);
    final ClusterService clusterService = getClusterService(instance);
    final Collection<Member> liteMembers = clusterService.getMembers(LITE_MEMBER_SELECTOR);
    final Collection<Member> dataMembers = clusterService.getMembers(DATA_MEMBER_SELECTOR);
    assertContains(dataMembers, localMember);
    assertNotContains(liteMembers, localMember);
    final Collection<Member> dataMembersWithoutThis = clusterService.getMembers(MemberSelectors.and(DATA_MEMBER_SELECTOR, NON_LOCAL_MEMBER_SELECTOR));
    assertNotContains(dataMembersWithoutThis, localMember);
    final Collection<Member> liteMembersWithThis = clusterService.getMembers(MemberSelectors.or(LITE_MEMBER_SELECTOR, LOCAL_MEMBER_SELECTOR));
    assertContains(liteMembersWithThis, localMember);
}
Also used : ClusterService(com.hazelcast.internal.cluster.ClusterService) Member(com.hazelcast.core.Member)

Example 32 with ClusterService

use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.

the class ClusterServiceMemberListTest method verifySizeFromDataMember.

private void verifySizeFromDataMember(final HazelcastInstance instance) {
    final ClusterService clusterService = getClusterService(instance);
    assertEquals(1, clusterService.getSize(MemberSelectors.LITE_MEMBER_SELECTOR));
    assertEquals(2, clusterService.getSize(MemberSelectors.DATA_MEMBER_SELECTOR));
    assertEquals(1, clusterService.getSize(MemberSelectors.and(DATA_MEMBER_SELECTOR, NON_LOCAL_MEMBER_SELECTOR)));
    assertEquals(2, clusterService.getSize(MemberSelectors.or(LITE_MEMBER_SELECTOR, LOCAL_MEMBER_SELECTOR)));
}
Also used : ClusterService(com.hazelcast.internal.cluster.ClusterService)

Aggregations

ClusterService (com.hazelcast.internal.cluster.ClusterService)32 Member (com.hazelcast.core.Member)8 ArrayList (java.util.ArrayList)8 Node (com.hazelcast.instance.Node)7 Address (com.hazelcast.nio.Address)7 OperationService (com.hazelcast.spi.OperationService)6 MemberImpl (com.hazelcast.instance.MemberImpl)5 StringUtil.bytesToString (com.hazelcast.util.StringUtil.bytesToString)5 Future (java.util.concurrent.Future)5 AbstractJobTracker (com.hazelcast.mapreduce.impl.AbstractJobTracker)4 NodeEngine (com.hazelcast.spi.NodeEngine)4 ILogger (com.hazelcast.logging.ILogger)3 Operation (com.hazelcast.spi.Operation)3 GroupConfig (com.hazelcast.config.GroupConfig)2 JobTrackerConfig (com.hazelcast.config.JobTrackerConfig)2 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)2 MapReduceService (com.hazelcast.mapreduce.impl.MapReduceService)2 MapReduceUtil.executeOperation (com.hazelcast.mapreduce.impl.MapReduceUtil.executeOperation)2 KeyValueJobOperation (com.hazelcast.mapreduce.impl.operation.KeyValueJobOperation)2 StartProcessingJobOperation (com.hazelcast.mapreduce.impl.operation.StartProcessingJobOperation)2