use of com.hazelcast.internal.cluster.Joiner in project hazelcast by hazelcast.
the class JoinMastershipClaimOp method run.
@Override
public void run() {
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
Node node = nodeEngine.getNode();
Joiner joiner = node.getJoiner();
ClusterServiceImpl clusterService = node.getClusterService();
final ILogger logger = node.getLogger(getClass().getName());
if (joiner instanceof TcpIpJoiner) {
TcpIpJoiner tcpIpJoiner = (TcpIpJoiner) joiner;
final Address endpoint = getCallerAddress();
final Address masterAddress = clusterService.getMasterAddress();
approvedAsMaster = !tcpIpJoiner.isClaimingMastership() && !clusterService.isMaster() && (masterAddress == null || masterAddress.equals(endpoint));
} else {
approvedAsMaster = false;
logger.warning("This node requires MulticastJoin strategy!");
}
if (logger.isFineEnabled()) {
logger.fine("Sending '" + approvedAsMaster + "' for master claim of node: " + getCallerAddress());
}
}
use of com.hazelcast.internal.cluster.Joiner in project hazelcast by hazelcast.
the class NodeMulticastListener method handleNotActiveOrNotJoined.
private void handleNotActiveOrNotJoined(JoinMessage joinMessage) {
if (isJoinRequest(joinMessage)) {
Joiner joiner = node.getJoiner();
if (joiner instanceof MulticastJoiner) {
MulticastJoiner multicastJoiner = (MulticastJoiner) joiner;
multicastJoiner.onReceivedJoinRequest((JoinRequest) joinMessage);
} else {
logDroppedMessage(joinMessage);
}
} else {
Address address = joinMessage.getAddress();
if (node.getJoiner().isBlacklisted(address)) {
logDroppedMessage(joinMessage);
return;
}
ClusterServiceImpl clusterService = node.getClusterService();
if (!clusterService.isJoined() && clusterService.getMasterAddress() == null) {
clusterService.setMasterAddressToJoin(joinMessage.getAddress());
} else {
logDroppedMessage(joinMessage);
}
}
}
Aggregations