From 35911856dbe63d166fd135dadfafc532b35e132e Mon Sep 17 00:00:00 2001 From: Edison Su Date: Wed, 14 Mar 2012 10:48:09 -0700 Subject: [PATCH] bug 14168: add re-try to mgt server, in case mgt server is down. status 14168: resolved fixed --- agent/src/com/cloud/agent/Agent.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agent/src/com/cloud/agent/Agent.java b/agent/src/com/cloud/agent/Agent.java index 3c4734da53f..4b7cec7340b 100755 --- a/agent/src/com/cloud/agent/Agent.java +++ b/agent/src/com/cloud/agent/Agent.java @@ -243,7 +243,13 @@ public class Agent implements HandlerFactory, IAgentControl { s_logger.error("Unable to start the resource: " + _resource.getName()); throw new CloudRuntimeException("Unable to start the resource: " + _resource.getName()); } + _connection.start(); + while (!_connection.isStartup()) { + _shell.getBackoffAlgorithm().waitBeforeRetry(); + _connection = new NioClient("Agent", _shell.getHost(), _shell.getPort(), _shell.getWorkers(), this); + _connection.start(); + } } public void stop(final String reason, final String detail) {