adding missing check for closed on proton receiver
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a9b32bdf Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a9b32bdf Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a9b32bdf Branch: refs/heads/master Commit: a9b32bdf0ba11df9b3ac13742fe375a551500731 Parents: e8eaf15 Author: Andy Taylor <[email protected]> Authored: Thu Dec 15 13:37:51 2016 +0000 Committer: Martyn Taylor <[email protected]> Committed: Thu Dec 15 13:40:47 2016 +0000 ---------------------------------------------------------------------- .../artemis/protocol/amqp/proton/ProtonServerSenderContext.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9b32bdf/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java index 79f49bf..52730e1 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java @@ -427,6 +427,7 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr @Override public void close(boolean remoteLinkClose) throws ActiveMQAMQPException { try { + closed = true; sessionSPI.closeSender(brokerConsumer); // if this is a link close rather than a connection close or detach, we need to delete // any durable resources for say pub subs @@ -466,6 +467,9 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr @Override public void onMessage(Delivery delivery) throws ActiveMQAMQPException { + if (closed) { + return; + } Object message = delivery.getContext(); boolean preSettle = sender.getRemoteSenderSettleMode() == SenderSettleMode.SETTLED; @@ -544,7 +548,6 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr */ public int deliverMessage(Object message, int deliveryCount) throws Exception { if (closed) { - System.err.println("Message can't be delivered as it's closed"); return 0; }
