Repository: activemq-artemis Updated Branches: refs/heads/master 23cc4f45c -> 3a8c25c4c
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. Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/51327753 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/51327753 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/51327753 Branch: refs/heads/master Commit: 5132775371300de3a0c34e119d205f546f070c63 Parents: 23cc4f4 Author: Clebert Suconic <[email protected]> Authored: Tue Oct 23 12:43:36 2018 -0400 Committer: Timothy Bish <[email protected]> Committed: Wed Oct 24 10:55:56 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/51327753/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 470aeb6..e38c22c 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 +
