Search in sources :

Example 1 with MemberPartitionStateImpl

use of com.hazelcast.internal.monitor.impl.MemberPartitionStateImpl in project hazelcast by hazelcast.

the class TimedMemberStateFactory method createMemberState.

private void createMemberState(MemberStateImpl memberState, Collection<StatisticsAwareService> services) {
    Node node = instance.node;
    final Collection<Client> clients = instance.node.clientEngine.getClients();
    final Set<ClientEndPointDTO> serializableClientEndPoints = createHashSet(clients.size());
    for (Client client : clients) {
        serializableClientEndPoints.add(new ClientEndPointDTO(client));
    }
    memberState.setClients(serializableClientEndPoints);
    memberState.setName(instance.getName());
    memberState.setUuid(node.getThisUuid());
    if (instance.getConfig().getCPSubsystemConfig().getCPMemberCount() == 0) {
        memberState.setCpMemberUuid(null);
    } else {
        CPMember localCPMember = instance.getCPSubsystem().getLocalCPMember();
        memberState.setCpMemberUuid(localCPMember != null ? localCPMember.getUuid() : null);
    }
    Address thisAddress = node.getThisAddress();
    memberState.setAddress(thisAddress.getHost() + ":" + thisAddress.getPort());
    memberState.setEndpoints(node.getLocalMember().getAddressMap());
    MemberPartitionStateImpl memberPartitionState = (MemberPartitionStateImpl) memberState.getMemberPartitionState();
    InternalPartitionService partitionService = node.getPartitionService();
    IPartition[] partitions = partitionService.getPartitions();
    List<Integer> partitionList = memberPartitionState.getPartitions();
    for (IPartition partition : partitions) {
        if (partition.isLocal()) {
            partitionList.add(partition.getPartitionId());
        }
    }
    memberPartitionState.setMemberStateSafe(memberStateSafe);
    memberState.setOperationStats(getOperationStats());
    createMemState(memberState, services);
    createNodeState(memberState);
    createHotRestartState(memberState);
    createClusterHotRestartStatus(memberState);
    memberState.setClientStats(getClientAttributes(node.getClientEngine().getClientStatistics()));
}
Also used : Address(com.hazelcast.cluster.Address) ClientEndPointDTO(com.hazelcast.internal.management.dto.ClientEndPointDTO) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) Node(com.hazelcast.instance.impl.Node) CPMember(com.hazelcast.cp.CPMember) MemberPartitionStateImpl(com.hazelcast.internal.monitor.impl.MemberPartitionStateImpl) Client(com.hazelcast.client.Client) IPartition(com.hazelcast.internal.partition.IPartition)

Aggregations

Client (com.hazelcast.client.Client)1 Address (com.hazelcast.cluster.Address)1 CPMember (com.hazelcast.cp.CPMember)1 Node (com.hazelcast.instance.impl.Node)1 ClientEndPointDTO (com.hazelcast.internal.management.dto.ClientEndPointDTO)1 MemberPartitionStateImpl (com.hazelcast.internal.monitor.impl.MemberPartitionStateImpl)1 IPartition (com.hazelcast.internal.partition.IPartition)1 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)1