You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/08/30 23:18:41 UTC

activemq-artemis git commit: ARTEMIS-2062 Only attempt to refill credit when needed

Repository: activemq-artemis
Updated Branches:
  refs/heads/2.6.x d58415873 -> 2029f897c


ARTEMIS-2062 Only attempt to refill credit when needed

Avoid firing the offerProducerCredit code when we know that the credit
isnt low enough that a refill is needed, which avoids lock contention
and garbage creation as each inbound message is processed.

(cherry picked from commit 960833d2be6cfd632334e7a81b042ea7281d3fdc)


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2029f897
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2029f897
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2029f897

Branch: refs/heads/2.6.x
Commit: 2029f897c7b367e99a28a0e2db0ee3eb822b18d8
Parents: d584158
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Aug 28 16:11:14 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Aug 30 19:17:28 2018 -0400

----------------------------------------------------------------------
 .../protocol/amqp/proton/ProtonServerReceiverContext.java        | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2029f897/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
index c3df1a7..e54a1a5 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
@@ -299,7 +299,9 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
    public void flow(int credits, int threshold) {
       // Use the SessionSPI to allocate producer credits, or default, always allocate credit.
       if (sessionSPI != null) {
-         sessionSPI.offerProducerCredit(address, credits, threshold, receiver);
+         if (receiver.getCredit() <= threshold) {
+            sessionSPI.offerProducerCredit(address, credits, threshold, receiver);
+         }
       } else {
          connection.lock();
          try {