From f2f355206740b6efb2359ad7296409fbfd62c5b3 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Tue, 3 Jan 2017 11:03:38 +0100 Subject: [PATCH] ARTEMIS-908: Hold connection lock when issuing credits --- .../artemis/protocol/amqp/broker/AMQPSessionCallback.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java index d8c908c327..3dce5dc28f 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java @@ -433,9 +433,11 @@ public class AMQPSessionCallback implements SessionCallback { store.checkMemory(new Runnable() { @Override public void run() { - if (receiver.getRemoteCredit() < threshold) { - receiver.flow(credits); - connection.flush(); + synchronized (connection.getLock()) { + if (receiver.getRemoteCredit() < threshold) { + receiver.flow(credits); + connection.flush(); + } } } });