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.
This commit is contained in:
Clebert Suconic 2018-10-23 12:43:36 -04:00 committed by Timothy Bish
parent 23cc4f45ce
commit 5132775371
1 changed files with 3 additions and 1 deletions

View File

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