CS-16258: Load Test - 1 host stuck in "Rebalancing" state forever. "java.lang.NullPointerException" seen in "Cluster-Worker" thread that was handling this process.

- Using temp to not affect the return value for the method.
This commit is contained in:
Prachi Damle 2012-09-06 16:00:58 -07:00
parent 61a19eb089
commit 60f130c509

View File

@ -1639,19 +1639,21 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
if (cmds != null) {
resource.disconnected();
}
if(host == null){
//In case of some db errors, we may land with the sitaution that host is null. We need to reload host from db and call disconnect on it so that it will be loaded for reconnection next time
HostVO tempHost = host;
if(tempHost == null){
if (cmds != null) {
StartupCommand firstCmd = cmds[0];
host = findHostByGuid(firstCmd.getGuid());
if (host == null) {
host = findHostByGuid(firstCmd.getGuidWithoutResource());
tempHost = findHostByGuid(firstCmd.getGuid());
if (tempHost == null) {
tempHost = findHostByGuid(firstCmd.getGuidWithoutResource());
}
}
}
if (host != null) {
if (tempHost != null) {
/* Change agent status to Alert */
_agentMgr.agentStatusTransitTo(host, Status.Event.AgentDisconnected, _nodeId);
_agentMgr.agentStatusTransitTo(tempHost, Status.Event.AgentDisconnected, _nodeId);
/* Don't change resource state here since HostVO is already in database, which means resource state has had an appropriate value*/
}
}