Skip to content

Commit

Permalink
If appliances.xml has a server whose name cannot be DNS resolved, we
Browse files Browse the repository at this point in the history
seem to be stuck in startup. Fix for Jud
  • Loading branch information
slacmshankar committed Sep 8, 2015
1 parent 9710202 commit de54cec
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,18 @@ public void postStartup() throws ConfigException {
} else {
String[] addressparts = applInfo.getClusterInetPort().split(":");
String inetaddrpart = addressparts[0];
InetAddress inetaddr = InetAddress.getByName(inetaddrpart);
if(!inetaddrpart.equals("localhost") && inetaddr.isLoopbackAddress()) {
logger.info("Address for appliance " + applInfo.getIdentity() + " - "+ inetaddr.toString() + " is a loopback address. Changing this to 127.0.0.1 to clustering happy");
inetaddr = InetAddress.getByName("127.0.0.1");
try {
InetAddress inetaddr = InetAddress.getByName(inetaddrpart);
if(!inetaddrpart.equals("localhost") && inetaddr.isLoopbackAddress()) {
logger.info("Address for appliance " + applInfo.getIdentity() + " - "+ inetaddr.toString() + " is a loopback address. Changing this to 127.0.0.1 to clustering happy");
inetaddr = InetAddress.getByName("127.0.0.1");
}
int clusterPort = Integer.parseInt(addressparts[1]);
logger.info("Adding " + applInfo.getIdentity() + " from appliances.xml to the cluster discovery using cluster inetport " + inetaddr.toString() + ":" + clusterPort);
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(inetaddr.getHostAddress() + ":" + clusterPort);
} catch(UnknownHostException ex) {
configlogger.info("Cannnot resolve the IP address for appliance " + inetaddrpart + ". Skipping adding this appliance to the cliuster.");
}
int clusterPort = Integer.parseInt(addressparts[1]);
logger.info("Adding " + applInfo.getIdentity() + " from appliances.xml to the cluster discovery using cluster inetport " + inetaddr.toString() + ":" + clusterPort);
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(inetaddr.getHostAddress() + ":" + clusterPort);
}
}
hzinstance = Hazelcast.newHazelcastInstance(config);
Expand Down

0 comments on commit de54cec

Please sign in to comment.