use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class HttpGetCommandProcessor method handleLogLevel.
private void handleLogLevel(HttpGetCommand command) {
LoggingServiceImpl loggingService = (LoggingServiceImpl) getNode().getLoggingService();
Level level = loggingService.getLevel();
prepareResponse(command, new JsonObject().add("logLevel", level == null ? null : level.getName()));
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class HttpGetCommandProcessor method handleCluster.
/**
* Sets the HTTP response to a string containing basic cluster information:
* <ul>
* <li>Member list</li>
* <li>Client connection count</li>
* <li>Connection count</li>
* </ul>
*
* @param command the HTTP request
*/
private void handleCluster(HttpGetCommand command) {
Node node = textCommandService.getNode();
Server server = node.getServer();
ClusterServiceImpl clusterService = node.getClusterService();
JsonArray membersArray = new JsonArray();
clusterService.getMembers().stream().map(m -> new JsonObject().add("address", m.getAddress().toString()).add("liteMember", m.isLiteMember()).add("localMember", m.localMember()).add("uuid", m.getUuid().toString()).add("memberVersion", m.getVersion().toString())).forEach(membersArray::add);
ServerConnectionManager cm = server.getConnectionManager(CLIENT);
int clientCount = cm == null ? 0 : cm.connectionCount(ServerConnection::isClient);
JsonObject response = new JsonObject().add("members", membersArray).add("connectionCount", clientCount).add("allConnectionCount", server.connectionCount());
prepareResponse(command, response);
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class ConfigUpdateResult method toJson.
public JsonObject toJson() {
JsonObject json = new JsonObject();
JsonArray addedConfigsAsJson = toJsonArray(addedConfigs);
JsonArray ignoredConfigsAsJson = toJsonArray(ignoredConfigs);
json.add("addedConfigs", addedConfigsAsJson);
json.add("ignoredConfigs", ignoredConfigsAsJson);
return json;
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class ConfigUpdateResult method toJsonArray.
private JsonArray toJsonArray(Set<ConfigNamespace> configs) {
JsonArray configsAsJson = new JsonArray();
for (ConfigNamespace ns : configs) {
JsonObject namespaceAsJson = new JsonObject();
namespaceAsJson.add("sectionName", ns.getSectionName());
namespaceAsJson.add("configName", ns.getConfigName());
configsAsJson.add(namespaceAsJson);
}
return configsAsJson;
}
use of com.hazelcast.internal.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;
}
Aggregations