use of com.hazelcast.internal.ascii.rest.RestCallExecution.ObjectType.MAP 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);
}
Aggregations