franz1981 commented on a change in pull request #2691: ARTEMIS-2364 collision 
avoidance for redelivery
URL: https://github.com/apache/activemq-artemis/pull/2691#discussion_r289617337
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
 ##########
 @@ -3458,9 +3460,15 @@ private long calculateRedeliveryDelay(final 
AddressSettings addressSettings, fin
       long redeliveryDelay = addressSettings.getRedeliveryDelay();
       long maxRedeliveryDelay = addressSettings.getMaxRedeliveryDelay();
       double redeliveryMultiplier = addressSettings.getRedeliveryMultiplier();
+      double collisionAvoidanceFactor = 
addressSettings.getRedeliveryCollisionAvoidanceFactor();
 
       int tmpDeliveryCount = deliveryCount > 0 ? deliveryCount - 1 : 0;
       long delay = (long) (redeliveryDelay * (Math.pow(redeliveryMultiplier, 
tmpDeliveryCount)));
+      if (collisionAvoidanceFactor > 0) {
+         Random random = RandomUtil.getRandom();
 
 Review comment:
   I mean this 
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadLocalRandom.html
   Random is synchronized on so it would block any concurrent calls 

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

Reply via email to