Search in sources :

Example 1 with MAP

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);
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) Address(com.hazelcast.cluster.Address) LoggingServiceImpl(com.hazelcast.logging.impl.LoggingServiceImpl) ServerConnection(com.hazelcast.internal.server.ServerConnection) JsonArray(com.hazelcast.internal.json.JsonArray) Level(java.util.logging.Level) Json(com.hazelcast.internal.json.Json) ClusterService(com.hazelcast.internal.cluster.ClusterService) SC_500(com.hazelcast.internal.ascii.rest.HttpStatusCode.SC_500) CPGroup(com.hazelcast.cp.CPGroup) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) StringUtil.equalsIgnoreCase(com.hazelcast.internal.util.StringUtil.equalsIgnoreCase) CPSession(com.hazelcast.cp.session.CPSession) JsonObject(com.hazelcast.internal.json.JsonObject) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) CPGroupId(com.hazelcast.cp.CPGroupId) ServerConnectionManager(com.hazelcast.internal.server.ServerConnectionManager) TextCommandService(com.hazelcast.internal.ascii.TextCommandService) StringUtil(com.hazelcast.internal.util.StringUtil) ExceptionUtil.peel(com.hazelcast.internal.util.ExceptionUtil.peel) CPSubsystemManagementService(com.hazelcast.cp.CPSubsystemManagementService) Collection(java.util.Collection) Server(com.hazelcast.internal.server.Server) NodeState(com.hazelcast.instance.impl.NodeState) MAP(com.hazelcast.internal.ascii.rest.RestCallExecution.ObjectType.MAP) Node(com.hazelcast.instance.impl.Node) CLIENT(com.hazelcast.instance.EndpointQualifier.CLIENT) CompletionStage(java.util.concurrent.CompletionStage) CPMember(com.hazelcast.cp.CPMember) ClusterState(com.hazelcast.cluster.ClusterState) CPSubsystem(com.hazelcast.cp.CPSubsystem) QUEUE(com.hazelcast.internal.ascii.rest.RestCallExecution.ObjectType.QUEUE) Server(com.hazelcast.internal.server.Server) ServerConnectionManager(com.hazelcast.internal.server.ServerConnectionManager) Node(com.hazelcast.instance.impl.Node) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) JsonObject(com.hazelcast.internal.json.JsonObject)

Aggregations

Address (com.hazelcast.cluster.Address)1 ClusterState (com.hazelcast.cluster.ClusterState)1 CPGroup (com.hazelcast.cp.CPGroup)1 CPGroupId (com.hazelcast.cp.CPGroupId)1 CPMember (com.hazelcast.cp.CPMember)1 CPSubsystem (com.hazelcast.cp.CPSubsystem)1 CPSubsystemManagementService (com.hazelcast.cp.CPSubsystemManagementService)1 CPSession (com.hazelcast.cp.session.CPSession)1 CLIENT (com.hazelcast.instance.EndpointQualifier.CLIENT)1 Node (com.hazelcast.instance.impl.Node)1 NodeState (com.hazelcast.instance.impl.NodeState)1 TextCommandService (com.hazelcast.internal.ascii.TextCommandService)1 SC_500 (com.hazelcast.internal.ascii.rest.HttpStatusCode.SC_500)1 MAP (com.hazelcast.internal.ascii.rest.RestCallExecution.ObjectType.MAP)1 QUEUE (com.hazelcast.internal.ascii.rest.RestCallExecution.ObjectType.QUEUE)1 ClusterService (com.hazelcast.internal.cluster.ClusterService)1 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)1 Json (com.hazelcast.internal.json.Json)1 JsonArray (com.hazelcast.internal.json.JsonArray)1 JsonObject (com.hazelcast.internal.json.JsonObject)1