brusdev commented on code in PR #5713:
URL: https://github.com/apache/activemq-artemis/pull/5713#discussion_r2116125749
##########
artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java:
##########
@@ -492,10 +491,16 @@ public boolean checkForcedConsumer(Message message) {
if
(message.containsProperty(ClientConsumerImpl.FORCED_DELIVERY_MESSAGE)) {
if (next >= 0) {
if (timeout <= 0) {
+ currentWindow.updateAndGet(i -> i > 0 ? i - 1 : i);
latch.countDown();
} else {
messagePullFuture = scheduledPool.schedule(() -> {
if (next >= 0) {
+ // Timed pull did not get a message before the
timeout, reduce credit. This
+ // can race with an actual message arriving so we must
ensure we don't reduce
+ // credit below zero as we want credit to always be
zero or on active pull it
+ // should be one (greater than one indicates a broken
client implementation).
+ currentWindow.updateAndGet(i -> i > 0 ? i - 1 : i);
Review Comment:
Without reading this comment could be difficult to understand why
`updateAndGet` is used in place of `decrementAndGet`. How about replacing
all occurrences of `currentWindow.updateAndGet(i -> i > 0 ? i - 1 : i);` with a
method with this comment?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact