franz1981 commented on a change in pull request #2707: ARTEMIS-2002 Proton 
transport objects leaked
URL: https://github.com/apache/activemq-artemis/pull/2707#discussion_r295149619
 
 

 ##########
 File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
 ##########
 @@ -183,6 +191,17 @@ public void flush() {
    }
 
    public void close(ErrorCondition errorCondition) {
+      synchronized (schedulingLock) {
+         isSchedulingCancelled = true;
+
+         if (scheduledPool != null && scheduledPool instanceof 
ThreadPoolExecutor &&
+            scheduledFuture != null && scheduledFuture instanceof Runnable) {
+            if (!((ThreadPoolExecutor) scheduledPool).remove((Runnable) 
scheduledFuture)) {
 
 Review comment:
   The other issue is perf-wise: if the work queue used on the 
`ScheduledExecutorService` is a `LinkedBlockingQueue` it requires a full lock 
on the queue to perform the remove, that's bad from a scalability point of 
view, given that the `ScheduledExecutorService` is shared between several 
components, see 
https://github.com/jdk-mirror/openjdk8/blob/master/java/util/concurrent/LinkedBlockingQueue.java#L548

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