CLOUDSTACK-8387 - Don't autoclose new mgmt server peer connections as soon as they open

This commit is contained in:
MS 2015-04-15 08:08:10 -07:00 committed by Marcus Sorensen
parent 940622c32f
commit cb7bcf23fe

View File

@ -498,7 +498,8 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
} catch (UnknownHostException e) {
throw new CloudRuntimeException("Unable to resolve " + ip);
}
try (SocketChannel ch1 = SocketChannel.open(new InetSocketAddress(addr, Port.value()));){
try {
SocketChannel ch1 = SocketChannel.open(new InetSocketAddress(addr, Port.value()));
ch1.configureBlocking(true); // make sure we are working at blocking mode
ch1.socket().setKeepAlive(true);
ch1.socket().setSoTimeout(60 * 1000);
@ -516,8 +517,9 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
if (s_logger.isDebugEnabled()) {
s_logger.debug("Connection to peer opened: " + peerName + ", ip: " + ip);
}
_peers.put(peerName, ch);
_peers.put(peerName, ch1);
_sslEngines.put(peerName, sslEngine);
return ch1;
} catch (IOException e) {
s_logger.warn("Unable to connect to peer management server: " + peerName + ", ip: " + ip + " due to " + e.getMessage(), e);
return null;