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);
}
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;
}
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>();
}
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);
}
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;
}
Aggregations