Search in sources :

Example 76 with JsonObject

use of com.eclipsesource.json.JsonObject 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 77 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class MemberStateImpl method serializeMap.

private static void serializeMap(JsonObject root, String key, Map<String, ? extends JsonSerializable> map) {
    final JsonObject jsonObject = new JsonObject();
    for (Entry<String, ? extends JsonSerializable> e : map.entrySet()) {
        jsonObject.add(e.getKey(), e.getValue().toJson());
    }
    root.add(key, jsonObject);
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString)

Example 78 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class TimedMemberState method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("master", master);
    root.add("time", time);
    root.add("clusterName", clusterName);
    JsonArray instanceNames = new JsonArray();
    for (String instanceName : this.instanceNames) {
        instanceNames.add(instanceName);
    }
    root.add("instanceNames", instanceNames);
    if (memberList != null) {
        JsonArray members = new JsonArray();
        for (String member : memberList) {
            members.add(member);
        }
        root.add("memberList", members);
    }
    root.add("memberState", memberState.toJson());
    return root;
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonObject(com.eclipsesource.json.JsonObject) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString)

Example 79 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class LocalExecutorStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("creationTime", creationTime);
    root.add("pending", pending);
    root.add("started", started);
    root.add("completed", completed);
    root.add("cancelled", cancelled);
    root.add("totalStartLatency", totalStartLatency);
    root.add("totalExecutionTime", totalExecutionTime);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 80 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class LocalMemoryStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add(JSON_CREATION_TIME, creationTime);
    root.add(JSON_TOTAL_PHYSICAL, totalPhysical);
    root.add(JSON_FREE_PHYSICAL, freePhysical);
    root.add(JSON_MAX_NATIVE_MEMORY, maxNativeMemory);
    root.add(JSON_COMMITTED_NATIVE_MEMORY, committedNativeMemory);
    root.add(JSON_USED_NATIVE_MEMORY, usedNativeMemory);
    root.add(JSON_FREE_NATIVE_MEMORY, freeNativeMemory);
    root.add(JSON_MAX_HEAP, maxHeap);
    root.add(JSON_COMMITTED_HEAP, committedHeap);
    root.add(JSON_USED_HEAP, usedHeap);
    if (gcStats == null) {
        gcStats = new LocalGCStatsImpl();
    }
    root.add(JSON_GC_STATS, gcStats.toJson());
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)126 Test (org.junit.Test)41 ParallelTest (com.hazelcast.test.annotation.ParallelTest)38 QuickTest (com.hazelcast.test.annotation.QuickTest)38 JsonArray (com.eclipsesource.json.JsonArray)14 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)12 HashMap (java.util.HashMap)12 Map (java.util.Map)9 JsonValue (com.eclipsesource.json.JsonValue)5 ExecuteScriptRequest (com.hazelcast.internal.management.request.ExecuteScriptRequest)5 BoxSharedLink (com.box.androidsdk.content.models.BoxSharedLink)4 WanPublisherConfig (com.hazelcast.config.WanPublisherConfig)4 ChangeClusterStateRequest (com.hazelcast.internal.management.request.ChangeClusterStateRequest)3 ChangeWanStateRequest (com.hazelcast.internal.management.request.ChangeWanStateRequest)3 ILogger (com.hazelcast.logging.ILogger)3 IOException (java.io.IOException)3 BoxEntity (com.box.androidsdk.content.models.BoxEntity)2 ParseException (com.eclipsesource.json.ParseException)2 ClusterState (com.hazelcast.cluster.ClusterState)2 MapConfig (com.hazelcast.config.MapConfig)2