wy96f commented on a change in pull request #2703: ARTEMIS-2380 Fix delivering
message in the case of consume close
URL: https://github.com/apache/activemq-artemis/pull/2703#discussion_r318946062
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/MessageReferenceImpl.java
##########
@@ -70,9 +70,7 @@ public int compare(MessageReference o1, MessageReference o2)
{
private final Queue queue;
- private long consumerID;
-
- private boolean hasConsumerID = false;
+ private long consumerID = -1L;
Review comment:
I'm not worried about our own generators since they all start from zero and
it would take long time to loop round especially used for consumer id.
Furthermore, number wrapping should not be allowed bcs this would resulting in
the consumer id clashing. But for custom id generators, it's not safe bcs they
maybe start from some negative numbers.
The purpose of this optimization is to prevent
RefsOperation::getListOnConsumer from throwing exception. There is some chance
that ref.emptyConsumerId() will be called between ref.hasConsumerId() and
ref.getConsumerId() == consumerID, which would throw IllegalStateException. I
don't feel strong about this optimization since getListOnConsumer is triggered
only by management service which would not affect core logic even if race
conditions happen. I can remove it and fix it later when better idea emerges.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services