Search in sources :

Example 1 with GetLeadedGroupsOp

use of com.hazelcast.cp.internal.operation.GetLeadedGroupsOp in project hazelcast by hazelcast.

the class CPGroupRebalanceTest method getLeadershipsMap.

private Map<CPMember, Collection<CPGroupId>> getLeadershipsMap(HazelcastInstance instance, Collection<CPMember> members) {
    OperationServiceImpl operationService = getOperationService(instance);
    Map<CPMember, Collection<CPGroupId>> leaderships = new HashMap<>();
    for (CPMember member : members) {
        Collection<CPGroupId> groups = operationService.<Collection<CPGroupId>>invokeOnTarget(null, new GetLeadedGroupsOp(), member.getAddress()).join();
        leaderships.put(member, groups);
    }
    return leaderships;
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) GetLeadedGroupsOp(com.hazelcast.cp.internal.operation.GetLeadedGroupsOp) HashMap(java.util.HashMap) Collection(java.util.Collection) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl) CPMember(com.hazelcast.cp.CPMember)

Aggregations

CPGroupId (com.hazelcast.cp.CPGroupId)1 CPMember (com.hazelcast.cp.CPMember)1 GetLeadedGroupsOp (com.hazelcast.cp.internal.operation.GetLeadedGroupsOp)1 OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1