From 18bc7e1a2ee9add2c97e19bdd6433715e97d02d8 Mon Sep 17 00:00:00 2001 From: dOkI Date: Fri, 5 May 2017 22:10:59 +0500 Subject: [PATCH] ARTEMIS-874: ThreadGroup memory leak --- .../activemq/artemis/utils/ActiveMQThreadFactory.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java index e5f76d3672..1644715cc4 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java @@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger; public final class ActiveMQThreadFactory implements ThreadFactory { - private final ThreadGroup group; + private String groupName; private final AtomicInteger threadCount = new AtomicInteger(0); @@ -59,7 +59,7 @@ public final class ActiveMQThreadFactory implements ThreadFactory { * @param tccl the context class loader of newly created threads */ public ActiveMQThreadFactory(final String groupName, String prefix, final boolean daemon, final ClassLoader tccl) { - group = new ThreadGroup(groupName + "-" + System.identityHashCode(this)); + this.groupName = groupName; this.prefix = prefix; @@ -97,7 +97,7 @@ public final class ActiveMQThreadFactory implements ThreadFactory { } private Thread createThread(final Runnable command) { - final Thread t = new Thread(group, command, prefix + threadCount.getAndIncrement() + " (" + group.getName() + ")"); + final Thread t = new Thread(command, prefix + threadCount.getAndIncrement() + " (" + groupName + ")"); t.setDaemon(daemon); t.setPriority(threadPriority); t.setContextClassLoader(tccl);