use of com.hazelcast.internal.cluster.ClusterService 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.cluster.ClusterService in project hazelcast by hazelcast.
the class HttpPostCommandProcessor method handleClusterShutdown.
private void handleClusterShutdown(HttpPostCommand command) throws UnsupportedEncodingException {
decodeParamsAndAuthenticate(command, 2);
ClusterService clusterService = getNode().getClusterService();
sendResponse(command, response(SUCCESS));
clusterService.shutdown();
}
use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class SplitBrainMergeValidationOp method preCheck.
private boolean preCheck(Node node) {
ILogger logger = getLogger();
ClusterService clusterService = node.getClusterService();
if (!clusterService.isJoined()) {
logger.info("Ignoring join check from " + getCallerAddress() + ", because this node is not joined to a cluster yet...");
return false;
}
if (!node.isRunning()) {
logger.info("Ignoring join check from " + getCallerAddress() + " because this node is not active...");
return false;
}
final ClusterState clusterState = clusterService.getClusterState();
if (!clusterState.isJoinAllowed()) {
logger.info("Ignoring join check from " + getCallerAddress() + " because cluster is in " + clusterState + " state...");
return false;
}
return true;
}
use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class MemberHeartbeatPlugin method run.
@Override
public void run(DiagnosticsLogWriter writer) {
ClusterService cs = nodeEngine.getClusterService();
if (!(cs instanceof ClusterServiceImpl)) {
// we don't want to cause problems
return;
}
render(writer, (ClusterServiceImpl) cs);
}
use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class TimedMemberStateFactory method createNodeState.
protected void createNodeState(MemberStateImpl memberState) {
Node node = instance.node;
ClusterService cluster = instance.node.clusterService;
NodeStateImpl nodeState = new NodeStateImpl(cluster.getClusterState(), node.getState(), cluster.getClusterVersion(), node.getVersion());
memberState.setNodeState(nodeState);
}
Aggregations