Search in sources :

Example 96 with JsonObject

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

the class ClearWanQueuesRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
    ClearWanQueuesOperation operation = new ClearWanQueuesOperation(schemeName, publisherName);
    Object operationResult = mcs.callOnThis(operation);
    JsonObject result = new JsonObject();
    if (operationResult == null) {
        result.add("result", SUCCESS);
    } else {
        result.add("result", operationResult.toString());
    }
    out.add("result", result);
}
Also used : ClearWanQueuesOperation(com.hazelcast.internal.management.operation.ClearWanQueuesOperation) JsonObject(com.eclipsesource.json.JsonObject) JsonObject(com.eclipsesource.json.JsonObject)

Example 97 with JsonObject

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

the class ClusterPropsRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) throws Exception {
    Runtime runtime = Runtime.getRuntime();
    RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
    IPartitionService partitionService = mcs.getHazelcastInstance().node.getPartitionService();
    JsonObject properties = new JsonObject();
    properties.add("hazelcast.cl_version", mcs.getHazelcastInstance().node.getBuildInfo().getVersion());
    properties.add("date.cl_startTime", Long.toString(runtimeMxBean.getStartTime()));
    properties.add("seconds.cl_upTime", Long.toString(runtimeMxBean.getUptime()));
    properties.add("memory.cl_freeMemory", Long.toString(runtime.freeMemory()));
    properties.add("memory.cl_totalMemory", Long.toString(runtime.totalMemory()));
    properties.add("memory.cl_maxMemory", Long.toString(runtime.maxMemory()));
    properties.add("return.hasOngoingMigration", Boolean.toString(partitionService.hasOnGoingMigration()));
    properties.add("data.cl_migrationTasksCount", Long.toString(partitionService.getMigrationQueueSize()));
    root.add("result", properties);
}
Also used : IPartitionService(com.hazelcast.spi.partition.IPartitionService) JsonObject(com.eclipsesource.json.JsonObject) RuntimeMXBean(java.lang.management.RuntimeMXBean)

Example 98 with JsonObject

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

the class ConsoleCommandRequest method toJson.

@Override
public JsonObject toJson() {
    final JsonObject root = new JsonObject();
    root.add("command", command);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 99 with JsonObject

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

the class SlowOperationDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("operation", operation);
    root.add("stackTrace", stackTrace);
    root.add("totalInvocations", totalInvocations);
    JsonArray invocationArray = new JsonArray();
    for (SlowOperationInvocationDTO invocation : invocations) {
        JsonObject json = invocation.toJson();
        if (json != null) {
            invocationArray.add(json);
        }
    }
    root.add("invocations", invocationArray);
    return root;
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonObject(com.eclipsesource.json.JsonObject)

Example 100 with JsonObject

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

the class WanPublisherConfigDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject object = new JsonObject();
    object.add("groupName", config.getGroupName());
    object.add("queueCapacity", config.getQueueCapacity());
    object.add("className", config.getClassName());
    object.add("queueFullBehavior", config.getQueueFullBehavior().getId());
    JsonObject properties = new JsonObject();
    for (Map.Entry<String, Comparable> property : config.getProperties().entrySet()) {
        properties.add(property.getKey(), Json.value(property.getValue().toString()));
    }
    object.add("properties", properties);
    return object;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) Map(java.util.Map)

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