Search in sources :

Example 6 with JsonObject

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

the class ThreadDumpRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) {
    final JsonObject result = new JsonObject();
    String threadDump = (String) mcs.callOnThis(new ThreadDumpOperation(dumpDeadlocks));
    if (threadDump != null) {
        result.add("hasDump", true);
        result.add("dump", threadDump);
    } else {
        result.add("hasDump", false);
    }
    root.add("result", result);
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) ThreadDumpOperation(com.hazelcast.internal.management.operation.ThreadDumpOperation) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString)

Example 7 with JsonObject

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

the class ExecuteScriptRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("script", script);
    root.add("engine", engine);
    JsonArray jsonTargets = new JsonArray();
    for (String target : targets) {
        jsonTargets.add(target);
    }
    root.add("targets", jsonTargets);
    root.add("targetAllMembers", targetAllMembers);
    return root;
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonObject(com.eclipsesource.json.JsonObject) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString)

Example 8 with JsonObject

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

the class ExecuteScriptRequest method fromJson.

@Override
public void fromJson(JsonObject json) {
    script = getString(json, "script", "");
    engine = getString(json, "engine", "");
    targets = new HashSet<String>();
    for (JsonValue target : getArray(json, "targets", new JsonArray())) {
        targets.add(target.asString());
    }
    targetAllMembers = getBoolean(json, "targetAllMembers", false);
    bindings = new HashMap<String, Object>();
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonValue(com.eclipsesource.json.JsonValue) JsonObject(com.eclipsesource.json.JsonObject) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString)

Example 9 with JsonObject

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

the class ForceStartNodeRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
    String resultString;
    HazelcastInstanceImpl instance = mcs.getHazelcastInstance();
    try {
        resultString = instance.node.getNodeExtension().getInternalHotRestartService().triggerForceStart() ? SUCCESS_RESULT : FAILED_RESULT;
    } catch (Exception e) {
        ILogger logger = instance.node.getLogger(getClass());
        logger.warning("Problem on force start: ", e);
        resultString = e.getMessage();
    }
    JsonObject result = new JsonObject().add("result", resultString);
    out.add("result", result);
}
Also used : HazelcastInstanceImpl(com.hazelcast.instance.HazelcastInstanceImpl) JsonObject(com.eclipsesource.json.JsonObject) ILogger(com.hazelcast.logging.ILogger) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString) IOException(java.io.IOException)

Example 10 with JsonObject

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

the class GetCacheEntryRequest method toJson.

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

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)499 Test (org.junit.Test)157 URL (java.net.URL)145 JsonArray (com.eclipsesource.json.JsonArray)96 JsonValue (com.eclipsesource.json.JsonValue)43 ParallelTest (com.hazelcast.test.annotation.ParallelTest)36 QuickTest (com.hazelcast.test.annotation.QuickTest)36 ArrayList (java.util.ArrayList)33 HashMap (java.util.HashMap)28 IOException (java.io.IOException)17 Map (java.util.Map)17 Matchers.containsString (org.hamcrest.Matchers.containsString)17 Date (java.util.Date)13 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)12 MalformedURLException (java.net.MalformedURLException)11 WalletCallException (com.vaklinov.zcashui.ZCashClientCaller.WalletCallException)7 URISyntaxException (java.net.URISyntaxException)6 ExecuteScriptRequest (com.hazelcast.internal.management.request.ExecuteScriptRequest)5 Link (org.eclipse.leshan.Link)5 Jedis (redis.clients.jedis.Jedis)5