Skip to content

Commit 0b0499b

Browse files
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 5132775)
1 parent ad92ea2 commit 0b0499b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ public boolean supportsDirectDelivery() {
349349

350350
@Override
351351
public HandleStatus handle(final MessageReference ref) throws Exception {
352-
if (callback != null && !callback.hasCredits(this) || availableCredits != null && availableCredits.get() <= 0) {
352+
// available credits can be set back to null with a flow control option.
353+
AtomicInteger checkInteger = availableCredits;
354+
if (callback != null && !callback.hasCredits(this) || checkInteger != null && checkInteger.get() <= 0) {
353355
if (logger.isDebugEnabled()) {
354356
logger.debug(this + " is busy for the lack of credits. Current credits = " +
355357
availableCredits +

0 commit comments

Comments
 (0)