/** * Sets a default handler on a link that is invoked when an AMQP <em>detach</em> frame * with its <em>close</em> property set to {@code true} is received from the peer. * <p> * The default handler sends a <em>detach</em> frame if the link has not been closed * locally already and then frees up the resources maintained for the link by invoking * its <em>free</em> method. * * @param <T> The type of link. * @param link The link to set the handler on. * @throws NullPointerException if link is {@code null}. */ public static <T extends ProtonLink<T>> void setDefaultCloseHandler(final ProtonLink<T> link) { link.closeHandler(remoteClose -> { if (link.isOpen()) { // peer has initiated closing // respond with our detach frame link.close(); } link.free(); }); }
/** * Sets a default handler on a link that is invoked when an AMQP <em>detach</em> frame * with its <em>close</em> property set to {@code true} is received from the peer. * <p> * The default handler sends a <em>detach</em> frame if the link has not been closed * locally already and then frees up the resources maintained for the link by invoking * its <em>free</em> method. * * @param <T> The type of link. * @param link The link to set the handler on. * @throws NullPointerException if link is {@code null}. */ public static <T extends ProtonLink<T>> void setDefaultCloseHandler(final ProtonLink<T> link) { link.closeHandler(remoteClose -> { if (link.isOpen()) { // peer has initiated closing // respond with our detach frame link.close(); } link.free(); }); }
private static void onTimeOut( final ProtonLink<?> link, final ClientConfigProperties clientConfig, final Future<?> result) { if (link.isOpen() && !HonoProtonHelper.isLinkEstablished(link)) { LOG.debug("link establishment timed out after {}ms", clientConfig.getLinkEstablishmentTimeout()); link.close(); link.free(); result.tryFail(new ServerErrorException(HttpsURLConnection.HTTP_UNAVAILABLE)); } }
} else if (link.isOpen()) {
} else if (link.isOpen()) {