From 8326a24fd87bdb8491db7b048b064aa01f9d7d33 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 11 Jul 2017 14:51:03 -0400 Subject: [PATCH] ARTEMIS-1280 Avoiding leak on Queue futures --- .../artemis/core/server/impl/QueueImpl.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 040a9964e7..897fde3800 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -83,7 +83,6 @@ import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes; import org.apache.activemq.artemis.core.transaction.impl.BindingsTransactionImpl; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; -import org.apache.activemq.artemis.utils.ConcurrentHashSet; import org.apache.activemq.artemis.utils.FutureLatch; import org.apache.activemq.artemis.utils.LinkedListIterator; import org.apache.activemq.artemis.utils.PriorityLinkedList; @@ -200,12 +199,8 @@ public class QueueImpl implements Queue { private Redistributor redistributor; - private final Set> futures = new ConcurrentHashSet<>(); - private ScheduledFuture redistributorFuture; - private ScheduledFuture checkQueueSizeFuture; - // We cache the consumers here since we don't want to include the redistributor private final AtomicInteger consumersCount = new AtomicInteger(); @@ -642,10 +637,6 @@ public class QueueImpl implements Queue { @Override public void close() throws Exception { - if (checkQueueSizeFuture != null) { - checkQueueSizeFuture.cancel(false); - } - getExecutor().execute(new Runnable() { @Override public void run() { @@ -793,8 +784,6 @@ public class QueueImpl implements Queue { DelayedAddRedistributor dar = new DelayedAddRedistributor(executor); redistributorFuture = scheduledExecutor.schedule(dar, delay, TimeUnit.MILLISECONDS); - - futures.add(redistributorFuture); } } else { internalAddRedistributor(executor); @@ -806,8 +795,6 @@ public class QueueImpl implements Queue { redistributorFuture = null; if (future != null) { future.cancel(false); - - futures.remove(future); } } @@ -826,10 +813,6 @@ public class QueueImpl implements Queue { @Override protected void finalize() throws Throwable { - if (checkQueueSizeFuture != null) { - checkQueueSizeFuture.cancel(false); - } - cancelRedistributor(); super.finalize();