Bug 14551: add top-level catch clause to protect task/thread from stalling

Reviewed-By: Kelven
This commit is contained in:
Kelven Yang 2012-03-29 18:22:29 -07:00
parent fa3d5612e0
commit f7649062a9
1 changed files with 11 additions and 8 deletions

View File

@ -691,16 +691,19 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
@Override
public synchronized void run() {
if (!cancelled) {
startRebalanceAgents();
if (s_logger.isInfoEnabled()) {
s_logger.info("The agent load balancer task is now being cancelled");
}
cancelled = true;
}
try {
if (!cancelled) {
startRebalanceAgents();
if (s_logger.isInfoEnabled()) {
s_logger.info("The agent load balancer task is now being cancelled");
}
cancelled = true;
}
} catch(Throwable e) {
s_logger.error("Unexpected exception " + e.toString(), e);
}
}
}
public void startRebalanceAgents() {
s_logger.debug("Management server " + _nodeId + " is asking other peers to rebalance their agents");