use of com.sleepycat.je.rep.utilint.ServiceDispatcher.ServiceConnectFailedException in project qpid-broker-j by apache.
the class ReplicatedEnvironmentFacade method getPermittedHostsFromHelper.
private static Collection<String> getPermittedHostsFromHelper(final String nodeName, final String groupName, final String helperNodeName, final String helperHostPort, final int dbPingSocketTimeout) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("Requesting state of the node '%s' at '%s'", helperNodeName, helperHostPort));
}
if (helperNodeName == null || "".equals(helperNodeName)) {
throw new IllegalConfigurationException(String.format("A helper node is not specified for node '%s'" + " joining the group '%s'", nodeName, groupName));
}
Collection<String> permittedNodes = null;
try {
ReplicationNodeImpl node = new ReplicationNodeImpl(helperNodeName, helperHostPort);
NodeState state = getRemoteNodeState(groupName, node, dbPingSocketTimeout);
byte[] applicationState = state.getAppState();
return convertApplicationStateBytesToPermittedNodeList(applicationState);
} catch (SocketTimeoutException ste) {
throw new ExternalServiceTimeoutException(String.format("Timed out trying to connect to existing node '%s' at '%s'", helperNodeName, helperHostPort), ste);
} catch (IOException | ServiceConnectFailedException e) {
throw new ExternalServiceException(String.format("Cannot connect to existing node '%s' at '%s'", helperNodeName, helperHostPort), e);
} catch (BinaryProtocol.ProtocolException e) {
String message = String.format("Unexpected protocol exception '%s' encountered while retrieving state for node '%s' (%s) from group '%s'", e.getUnexpectedMessage(), helperNodeName, helperHostPort, groupName);
LOGGER.warn(message, e);
throw new ExternalServiceException(message, e);
} catch (RuntimeException e) {
throw new ExternalServiceException(String.format("Cannot retrieve state for node '%s' (%s) from group '%s'", helperNodeName, helperHostPort, groupName), e);
}
}
Aggregations