Search in sources :

Example 6 with ClientEndPointDTO

use of com.hazelcast.internal.management.dto.ClientEndPointDTO in project hazelcast by hazelcast.

the class MemberStateImpl method toJson.

@Override
public JsonObject toJson() {
    final JsonObject root = new JsonObject();
    root.add("address", address);
    serializeMap(root, "mapStats", mapStats);
    serializeMap(root, "multiMapStats", multiMapStats);
    serializeMap(root, "replicatedMapStats", replicatedMapStats);
    serializeMap(root, "queueStats", queueStats);
    serializeMap(root, "topicStats", topicStats);
    serializeMap(root, "executorStats", executorStats);
    serializeMap(root, "cacheStats", cacheStats);
    serializeMap(root, "wanStats", wanStats);
    final JsonObject runtimePropsObject = new JsonObject();
    for (Map.Entry<String, Long> entry : runtimeProps.entrySet()) {
        runtimePropsObject.add(entry.getKey(), entry.getValue());
    }
    root.add("runtimeProps", runtimePropsObject);
    final JsonArray clientsArray = new JsonArray();
    for (ClientEndPointDTO client : clients) {
        clientsArray.add(client.toJson());
    }
    root.add("clients", clientsArray);
    root.add("beans", beans.toJson());
    root.add("memoryStats", memoryStats.toJson());
    root.add("operationStats", operationStats.toJson());
    root.add("memberPartitionState", memberPartitionState.toJson());
    root.add("nodeState", nodeState.toJson());
    root.add("hotRestartState", hotRestartState.toJson());
    root.add("clusterHotRestartStatus", clusterHotRestartStatus.toJson());
    root.add("wanSyncState", wanSyncState.toJson());
    return root;
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) ClientEndPointDTO(com.hazelcast.internal.management.dto.ClientEndPointDTO) JsonObject(com.eclipsesource.json.JsonObject) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with ClientEndPointDTO

use of com.hazelcast.internal.management.dto.ClientEndPointDTO 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)

Example 8 with ClientEndPointDTO

use of com.hazelcast.internal.management.dto.ClientEndPointDTO in project hazelcast by hazelcast.

the class MemberStateImpl method toJson.

@Override
public JsonObject toJson() {
    final JsonObject root = new JsonObject();
    root.add("address", address);
    String uuidString = uuid != null ? uuid.toString() : null;
    root.add("uuid", uuidString);
    String cpMemberUuidString = cpMemberUuid != null ? cpMemberUuid.toString() : null;
    root.add("cpMemberUuid", cpMemberUuidString);
    root.add("name", name);
    final JsonArray endpoints = new JsonArray();
    for (Entry<EndpointQualifier, Address> entry : this.endpoints.entrySet()) {
        JsonObject address = new JsonObject();
        address.set("host", entry.getValue().getHost());
        address.set("port", entry.getValue().getPort());
        JsonObject endpoint = new JsonObject();
        endpoint.set("protocol", entry.getKey().getType().name());
        endpoint.set("address", address);
        if (entry.getKey().getIdentifier() != null) {
            endpoint.set("id", entry.getKey().getIdentifier());
        }
        endpoints.add(endpoint);
    }
    root.add("endpoints", endpoints);
    serializeAsMap(root, "mapStats", mapsWithStats);
    serializeAsMap(root, "multiMapStats", multiMapsWithStats);
    serializeAsMap(root, "replicatedMapStats", replicatedMapsWithStats);
    serializeAsMap(root, "queueStats", queuesWithStats);
    serializeAsMap(root, "topicStats", topicsWithStats);
    serializeAsMap(root, "reliableTopicStats", reliableTopicsWithStats);
    serializeAsMap(root, "pnCounterStats", pnCountersWithStats);
    serializeAsMap(root, "executorStats", executorsWithStats);
    serializeAsMap(root, "scheduledExecutorStats", scheduledExecutorsWithStats);
    serializeAsMap(root, "durableExecutorStats", durableExecutorsWithStats);
    serializeAsMap(root, "cacheStats", cachesWithStats);
    serializeAsMap(root, "flakeIdStats", flakeIdGeneratorsWithStats);
    serializeMap(root, "wanStats", wanStats);
    final JsonArray clientsArray = new JsonArray();
    for (ClientEndPointDTO client : clients) {
        clientsArray.add(client.toJson());
    }
    root.add("clients", clientsArray);
    addJsonIfSerializable(root, "operationStats", operationStats);
    root.add("memberPartitionState", memberPartitionState.toJson());
    root.add("nodeState", nodeState.toJson());
    root.add("hotRestartState", hotRestartState.toJson());
    root.add("clusterHotRestartStatus", clusterHotRestartStatus.toJson());
    JsonObject clientStatsObject = new JsonObject();
    for (Map.Entry<UUID, String> entry : clientStats.entrySet()) {
        clientStatsObject.add(entry.getKey().toString(), entry.getValue());
    }
    root.add("clientStats", clientStatsObject);
    return root;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) Address(com.hazelcast.cluster.Address) ClientEndPointDTO(com.hazelcast.internal.management.dto.ClientEndPointDTO) JsonObject(com.hazelcast.internal.json.JsonObject) EndpointQualifier(com.hazelcast.instance.EndpointQualifier) JsonUtil.getString(com.hazelcast.internal.util.JsonUtil.getString) UUID(java.util.UUID) HashMap(java.util.HashMap) Map(java.util.Map) Collections.emptyMap(java.util.Collections.emptyMap)

Aggregations

ClientEndPointDTO (com.hazelcast.internal.management.dto.ClientEndPointDTO)8 Address (com.hazelcast.cluster.Address)4 ClusterHotRestartStatusDTO (com.hazelcast.internal.management.dto.ClusterHotRestartStatusDTO)4 HashMap (java.util.HashMap)4 EndpointQualifier (com.hazelcast.instance.EndpointQualifier)3 JsonArray (com.eclipsesource.json.JsonArray)2 JsonObject (com.eclipsesource.json.JsonObject)2 CacheStatisticsImpl (com.hazelcast.cache.impl.CacheStatisticsImpl)2 ClusterState (com.hazelcast.cluster.ClusterState)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 JsonArray (com.hazelcast.internal.json.JsonArray)2 JsonObject (com.hazelcast.internal.json.JsonObject)2 TimedMemberStateFactory (com.hazelcast.internal.management.TimedMemberStateFactory)2 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)2 JsonUtil.getString (com.hazelcast.internal.util.JsonUtil.getString)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 MemberVersion (com.hazelcast.version.MemberVersion)2 Version (com.hazelcast.version.Version)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2