Skip to content

Commit

Permalink
ARTEMIS-2146 Avoiding NPE on AMQP Flow Control
Browse files Browse the repository at this point in the history
AMQP Flow control will disable consumer flow control (setting credits to null)
This will avoid a race checking flow control.
  • Loading branch information
clebertsuconic authored and tabish121 committed Oct 24, 2018
1 parent 23cc4f4 commit 5132775
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -349,7 +349,9 @@ public boolean supportsDirectDelivery() {

@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 +
Expand Down

0 comments on commit 5132775

Please sign in to comment.