jbertram commented on code in PR #4823:
URL: https://github.com/apache/activemq-artemis/pull/4823#discussion_r1495064560


##########
artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java:
##########
@@ -461,8 +459,14 @@ public int generateMqttId(long messageId, long consumerId) 
{
          synchronized (dataStoreLock) {
             Integer id = artemisToMqttMessageMap.get(generateKey(messageId, 
consumerId));
             if (id == null) {
-               ids.compareAndSet(Short.MAX_VALUE, 1);
-               id = ids.addAndGet(1);
+               do {
+                  if (currentId == 0xffff) {

Review Comment:
   You can use 
`org.apache.activemq.artemis.core.protocol.mqtt.MQTTUtil#TWO_BYTE_INT_MAX` here 
instead of `0xffff`.



-- 
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]

Reply via email to