Better error handling for some corner cases

Make the exceptions more descriptive so admins can pinpoint the issue
easier.
This commit is contained in:
Hugo Trippaers 2013-03-29 11:55:00 +01:00
parent 95fce11215
commit 9a5bf78c3e
1 changed files with 11 additions and 2 deletions

View File

@ -95,8 +95,13 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout
SynchronousListener synchronous = (SynchronousListener)listener;
String peerName = synchronous.getPeer();
if (peerName != null) {
s_logger.debug(log(seq, "Forwarding to peer to cancel due to timeout"));
s_clusteredAgentMgr.cancel(peerName, _id, seq, "Timed Out");
if (s_clusteredAgentMgr != null) {
s_logger.debug(log(seq, "Forwarding to peer to cancel due to timeout"));
s_clusteredAgentMgr.cancel(peerName, _id, seq, "Timed Out");
} else {
s_logger.error("Unable to forward cancel, ClusteredAgentAttache is not properly initialized");
}
}
}
}
@ -159,6 +164,10 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout
}
}
if (s_clusteredAgentMgr == null) {
throw new AgentUnavailableException("ClusteredAgentAttache not properly initialized", _id);
}
int i = 0;
SocketChannel ch = null;
boolean error = true;