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/10/24 15:21:16 UTC

activemq-artemis git commit: ARTEMIS-2146 Avoiding NPE on AMQP Flow Control

Repository: activemq-artemis
Updated Branches:
  refs/heads/2.6.x ad92ea2c0 -> 0b0499b8a


ARTEMIS-2146 Avoiding NPE on AMQP Flow Control

AMQP Flow control will disable consumer flow control (setting credits to null)
This will avoid a race checking flow control.

(cherry picked from commit 5132775371300de3a0c34e119d205f546f070c63)


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

Branch: refs/heads/2.6.x
Commit: 0b0499b8a9a290d59525c0cd31b42f0695de7830
Parents: ad92ea2
Author: Clebert Suconic <cl...@apache.org>
Authored: Tue Oct 23 12:43:36 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Oct 24 11:20:54 2018 -0400

----------------------------------------------------------------------
 .../activemq/artemis/core/server/impl/ServerConsumerImpl.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0b0499b8/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
index ad8e668..fa81bfb 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
@@ -349,7 +349,9 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
 
    @Override
    public HandleStatus handle(final MessageReference ref) throws Exception {
-      if (callback != null && !callback.hasCredits(this) || availableCredits != null && availableCredits.get() <= 0) {
+      // available credits can be set back to null with a flow control option.
+      AtomicInteger checkInteger = availableCredits;
+      if (callback != null && !callback.hasCredits(this) || checkInteger != null && checkInteger.get() <= 0) {
          if (logger.isDebugEnabled()) {
             logger.debug(this + " is busy for the lack of credits. Current credits = " +
                             availableCredits +