Search in sources :

Example 81 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 82 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 83 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)

Example 84 with JsonObject

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

the class LocalReplicatedMapStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("getCount", getCount);
    root.add("putCount", putCount);
    root.add("removeCount", removeCount);
    root.add("numberOfOtherOperations", numberOfOtherOperations);
    root.add("numberOfEvents", numberOfEvents);
    root.add("lastAccessTime", lastAccessTime);
    root.add("lastUpdateTime", lastUpdateTime);
    root.add("hits", hits);
    root.add("ownedEntryCount", ownedEntryCount);
    root.add("ownedEntryMemoryCost", ownedEntryMemoryCost);
    root.add("creationTime", creationTime);
    root.add("totalGetLatencies", totalGetLatencies);
    root.add("totalPutLatencies", totalPutLatencies);
    root.add("totalRemoveLatencies", totalRemoveLatencies);
    root.add("maxGetLatency", maxGetLatency);
    root.add("maxPutLatency", maxPutLatency);
    root.add("maxRemoveLatency", maxRemoveLatency);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 85 with JsonObject

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

the class ClusterHotRestartStatusDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("dataRecoveryPolicy", dataRecoveryPolicy.toString());
    root.add("hotRestartStatus", hotRestartStatus.toString());
    root.add("remainingValidationTimeMillis", remainingValidationTimeMillis);
    root.add("remainingDataLoadTimeMillis", remainingDataLoadTimeMillis);
    JsonArray memberStatuses = new JsonArray();
    for (Map.Entry<String, MemberHotRestartStatus> entry : memberHotRestartStatusMap.entrySet()) {
        String member = entry.getKey();
        MemberHotRestartStatus status = entry.getValue();
        JsonObject pair = new JsonObject();
        pair.add("member", member);
        pair.add("status", status.toString());
        memberStatuses.add(pair);
    }
    root.add("memberHotRestartStatuses", memberStatuses);
    return root;
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonObject(com.eclipsesource.json.JsonObject) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)127 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