Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2467#discussion_r242787574 --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java --- @@ -471,40 +494,42 @@ public void onFlow(Link link) throws Exception { @Override public void onRemoteClose(Link link) throws Exception { - lock(); - try { + handler.requireHandler(); + + // We scheduled it for later, as that will work through anything that's pending on the current deliveries. + runLater(() -> { link.close(); link.free(); - } finally { - unlock(); - } - ProtonDeliveryHandler linkContext = (ProtonDeliveryHandler) link.getContext(); - if (linkContext != null) { - linkContext.close(true); - } + ProtonDeliveryHandler linkContext = (ProtonDeliveryHandler) link.getContext(); + if (linkContext != null) { + try { + linkContext.close(true); + } catch (Exception e) { + log.error(e.getMessage(), e); --- End diff -- this should have a static logger method
---