public AmqpException(ErrorCondition errorCondition) { super(errorCondition.getDescription()); this.errorCondition = errorCondition; }
private static IOException reconstructIOException(ErrorCondition errorCondition) { // since proton library communicates all errors based on amqp-error-condition // it swallows the IOException and translates it to proton-io errorCode // we reconstruct the IOException in this case - but, callstack is lost return new IOException(errorCondition.getDescription()); } }
public int size() { return _errorCondition.getInfo() != null ? 3 : _errorCondition.getDescription() != null ? 2 : 1; }
public int size() { return _errorCondition.getInfo() != null ? 3 : _errorCondition.getDescription() != null ? 2 : 1; }
public int size() { return _errorCondition.getInfo() != null ? 3 : _errorCondition.getDescription() != null ? 2 : 1; }
public int size() { return _errorCondition.getInfo() != null ? 3 : _errorCondition.getDescription() != null ? 2 : 1; }
public Object get(final int index) { switch(index) { case 0: return _errorCondition.getCondition(); case 1: return _errorCondition.getDescription(); case 2: return _errorCondition.getInfo(); } throw new IllegalStateException("Unknown index " + index); }
public Object get(final int index) { switch(index) { case 0: return _errorCondition.getCondition(); case 1: return _errorCondition.getDescription(); case 2: return _errorCondition.getInfo(); } throw new IllegalStateException("Unknown index " + index); }
@Override public void onSessionFinal(Event e) { if (TRACE_LOGGER.isInfoEnabled()) { final Session session = e.getSession(); ErrorCondition condition = session != null ? session.getCondition() : null; TRACE_LOGGER.info(String.format(Locale.US, "onSessionFinal entityName[%s], condition[%s], description[%s]", this.entityName, condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } }
public void processOnClose(Link link, ErrorCondition condition) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("processOnClose linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } this.underlyingEntity.onClose(condition); }
public void processOnClose(Link link, ErrorCondition condition) { if (condition != null) { TRACE_LOGGER.debug("linkName:{}, ErrorCondition:{}, {}", link.getName(), condition.getCondition(), condition.getDescription()); } this.underlyingEntity.onClose(condition); }
@Override public void onLinkRemoteClose(Event event) { final Link link = event.getLink(); final ErrorCondition condition = link.getRemoteCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("onLinkRemoteClose linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } handleRemoteLinkClosed(event); }
@Override public void onConnectionRemoteClose(Event event) { final Connection connection = event.getConnection(); final ErrorCondition error = connection.getRemoteCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onConnectionRemoteClose: hostname[%s], errorCondition[%s], errorDescription[%s]", connection.getHostname(), error != null ? error.getCondition() : "n/a", error != null ? error.getDescription() : "n/a")); } this.amqpConnection.onConnectionError(error); }
@Override public void onLinkRemoteDetach(Event event) { final Link link = event.getLink(); final ErrorCondition condition = link.getCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("onLinkRemoteDetach linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } handleRemoteLinkClosed(event); }
/** * Closes the specified link using the given throwable to set the local ErrorCondition object for the link. * * @param link The link to close. * @param t The throwable to use to determine the error condition object. */ private <T extends ProtonLink<T>> void closeLinkWithError(final ProtonLink<T> link, final Throwable t) { final ErrorCondition ec = AmqpContext.getErrorCondition(t); LOG.debug("closing link with error condition [symbol: {}, description: {}]", ec.getCondition(), ec.getDescription()); link.setCondition(ec); link.close(); }
protected final void onLinkDetach(final UpstreamReceiver client, final ErrorCondition error) { if (error == null) { logger.debug("closing receiver for client [{}]", client.getLinkId()); } else { logger.debug("closing receiver for client [{}]: {}", client.getLinkId(), error.getDescription()); } client.close(error); removeClientLink(client.getLinkId()); }
@Override public void onLinkLocalClose(Event event) { final Link link = event.getLink(); final ErrorCondition condition = link.getCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("onLinkLocalClose linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } closeSession(link, link.getCondition()); }
private void closeSession(Link link, ErrorCondition condition) { final Session session = link.getSession(); if (session != null && session.getLocalState() != EndpointState.CLOSED) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("closeSession for linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } session.setCondition(condition); session.close(); } }
/** * Detach the provided link with an AMQP error condition * * @param link AMQP link to detach * @param error AMQP error condition */ static void detachWithError(ProtonLink<?> link, ErrorCondition error) { log.error("Detaching link {} due to error {}, description: {}", link, error.getCondition(), error.getDescription()); link.setSource(null) .open() .setCondition(error) .close(); }
@Override public void onConnectionRemoteClose(Event event) { final Connection connection = event.getConnection(); final ErrorCondition error = connection.getRemoteCondition(); TRACE_LOGGER.debug("onConnectionRemoteClose: hostname:{},errorCondition:{}", connection.getHostname(), error != null ? error.getCondition() + "," + error.getDescription() : null); boolean shouldFreeConnection = connection.getLocalState() == EndpointState.CLOSED; this.messagingFactory.onConnectionError(error); if(shouldFreeConnection) { connection.free(); } }