wy96f commented on a change in pull request #2726: ARTEMIS-2392 Enable remove 
on cancel policy for scheduled pool
URL: https://github.com/apache/activemq-artemis/pull/2726#discussion_r314688744
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
 ##########
 @@ -2667,10 +2667,18 @@ public ThreadFactory run() {
                return new ActiveMQThreadFactory("ActiveMQ-scheduled-threads", 
false, ClientSessionFactoryImpl.class.getClassLoader());
             }
          });
-         scheduledPool = new 
ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), 
tFactory);
+
+         ScheduledThreadPoolExecutor scheduledPoolExecutor = new 
ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), 
tFactory);
+         scheduledPoolExecutor.setRemoveOnCancelPolicy(true);
+         scheduledPool = scheduledPoolExecutor;
       } else {
          this.scheduledPoolSupplied = true;
          this.scheduledPool = serviceRegistry.getScheduledExecutorService();
+
+         if (!(scheduledPool instanceof ScheduledThreadPoolExecutor) ||
 
 Review comment:
   Shouldn't this be `if (scheduledPool instanceof ScheduledThreadPoolExecutor 
&& !((ScheduledThreadPoolExecutor) scheduledPool).getRemoveOnCancelPolicy()) {`?
   
   ScheduledExecutorService used by broker might remove task after cancel, E.g. 
kinds of executors in Netty.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to