use of com.hazelcast.internal.server.tcp.LinkedAddresses in project hazelcast by hazelcast.
the class TcpIpJoiner method searchForOtherClusters.
@Override
public void searchForOtherClusters() {
final Collection<Address> possibleAddresses;
try {
possibleAddresses = getPossibleAddresses();
} catch (Throwable e) {
logger.severe(e);
return;
}
LocalAddressRegistry addressRegistry = node.getLocalAddressRegistry();
possibleAddresses.removeAll(addressRegistry.getLocalAddresses());
node.getClusterService().getMembers().forEach(member -> {
LinkedAddresses addresses = addressRegistry.linkedAddressesOf(member.getUuid());
if (addresses != null) {
Set<Address> knownMemberAddresses = addresses.getAllAddresses();
possibleAddresses.removeAll(knownMemberAddresses);
} else {
// do not expect this case in the normal conditions, except for disconnections happens
// at the same time
possibleAddresses.remove(member.getAddress());
}
});
if (possibleAddresses.isEmpty()) {
return;
}
SplitBrainJoinMessage request = node.createSplitBrainJoinMessage();
for (Address address : possibleAddresses) {
SplitBrainMergeCheckResult result = sendSplitBrainJoinMessageAndCheckResponse(address, request);
if (result == SplitBrainMergeCheckResult.LOCAL_NODE_SHOULD_MERGE) {
logger.warning(node.getThisAddress() + " is merging [tcp/ip] to " + address);
setTargetAddress(address);
startClusterMerge(address, request.getMemberListVersion());
return;
}
}
}
use of com.hazelcast.internal.server.tcp.LinkedAddresses in project hazelcast by hazelcast.
the class ClusterMismatchOp method run.
@Override
public void run() {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
Connection connection = getConnection();
String message = "Node could not join cluster at node: " + connection.getRemoteAddress() + " Cause: the target cluster has a different cluster-name";
Node node = nodeEngine.getNode();
LinkedAddresses linkedAddresses = node.getLocalAddressRegistry().linkedAddressesOf(getCallerUuid());
connection.close(message, null);
ILogger logger = nodeEngine.getLogger("com.hazelcast.cluster");
logger.warning(message);
if (linkedAddresses != null) {
for (Address address : linkedAddresses.getAllAddresses()) {
node.getJoiner().blacklist(address, true);
}
} else {
node.getJoiner().blacklist(getCallerAddress(), true);
}
}
Aggregations