michaelandrepearce commented on a change in pull request #2727: ARTEMIS-2394 
Improve scheduling sync for AMQPConnectionContext
URL: https://github.com/apache/activemq-artemis/pull/2727#discussion_r303676682
 
 

 ##########
 File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
 ##########
 @@ -436,16 +434,18 @@ public void onRemoteOpen(Connection connection) throws 
Exception {
       public void run() {
          Long rescheduleAt = handler.tick(false);
 
-         synchronized (schedulingLock) {
-            if (!isSchedulingCancelled) {
+         scheduledFutureRef.getAndUpdate(value -> {
+            if (value != null) {
                if (rescheduleAt == null) {
 
 Review comment:
   e.g.
   ```
            Long rescheduleAt = handler.tick(false);
            if (rescheduleAt == null) {
               scheduledFutureRef.getAndUpdate(value -> value == null ? null : 
scheduledPool.schedule(scheduleRunnable, 10, TimeUnit.MILLISECONDS));
            } else if (rescheduleAt != 0) {
               scheduledFutureRef.getAndUpdate(value -> value == null ? null : 
scheduledPool.schedule(scheduleRunnable, rescheduleAt - 
TimeUnit.NANOSECONDS.toMillis(System.nanoTime()), TimeUnit.MILLISECONDS));
            }
   ```
   

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