use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class MemberRemoveOperation method run.
@Override
public void run() {
ClusterServiceImpl clusterService = getService();
Address caller = getCallerAddress();
ILogger logger = getLogger();
if (!isCallerValid(caller)) {
return;
}
String msg = "Removing member " + address + (memberUuid != null ? ", uuid: " + memberUuid : "") + ", requested by: " + caller;
if (logger.isFineEnabled()) {
logger.fine(msg);
}
if (memberUuid != null) {
clusterService.removeAddress(address, memberUuid, msg);
} else {
clusterService.removeAddress(address, msg);
}
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class SetMasterOperation method run.
@Override
public void run() {
ClusterServiceImpl clusterService = getService();
clusterService.getClusterJoinManager().setMaster(masterAddress, getCallerAddress());
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class SplitBrainMergeValidationOperation method masterCheck.
private boolean masterCheck(Node node) {
ILogger logger = getLogger();
Address caller = getCallerAddress();
ClusterServiceImpl service = getService();
if (node.isMaster()) {
if (service.getMember(caller) != null) {
logger.info("Removing " + caller + ", since it thinks it's already split from this cluster " + "and looking to merge.");
removeCaller = true;
}
return true;
} else {
// ping master to check if it's still valid
service.getClusterHeartbeatManager().sendMasterConfirmation();
logger.info("Ignoring join check from " + caller + ", because this node is not master...");
return false;
}
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class FinalizeJoinOperation method sendPostJoinOperations.
private void sendPostJoinOperations() {
final ClusterServiceImpl clusterService = getService();
final NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
// Post join operations must be lock free; means no locks at all;
// no partition locks, no key-based locks, no service level locks!
final Operation[] postJoinOperations = nodeEngine.getPostJoinOperations();
final OperationService operationService = nodeEngine.getOperationService();
if (postJoinOperations != null && postJoinOperations.length > 0) {
final Collection<Member> members = clusterService.getMembers();
for (Member member : members) {
if (!member.localMember()) {
PostJoinOperation operation = new PostJoinOperation(postJoinOperations);
operationService.createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME, operation, member.getAddress()).setTryCount(POST_JOIN_TRY_COUNT).invoke();
}
}
}
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class HttpGetCommandProcessor method handleHealthcheck.
private void handleHealthcheck(HttpGetCommand command) {
Node node = textCommandService.getNode();
NodeState nodeState = node.getState();
ClusterServiceImpl clusterService = node.getClusterService();
ClusterState clusterState = clusterService.getClusterState();
int clusterSize = clusterService.getMembers().size();
InternalPartitionService partitionService = node.getPartitionService();
boolean memberStateSafe = partitionService.isMemberStateSafe();
boolean clusterSafe = memberStateSafe && !partitionService.hasOnGoingMigration();
long migrationQueueSize = partitionService.getMigrationQueueSize();
StringBuilder res = new StringBuilder();
res.append("Hazelcast::NodeState=").append(nodeState).append("\n");
res.append("Hazelcast::ClusterState=").append(clusterState).append("\n");
res.append("Hazelcast::ClusterSafe=").append(Boolean.toString(clusterSafe).toUpperCase()).append("\n");
res.append("Hazelcast::MigrationQueueSize=").append(migrationQueueSize).append("\n");
res.append("Hazelcast::ClusterSize=").append(clusterSize).append("\n");
command.setResponse(MIME_TEXT_PLAIN, stringToBytes(res.toString()));
}
Aggregations