This is an automated email from the ASF dual-hosted git repository. ifesdjeen pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push: new c49d42f Remove unnecessary Runnable wrapping in NamedThreadFactory as is done by Netty. c49d42f is described below commit c49d42f318c735676d1cb8984c1dee8ae46b3c0d Author: Alex Petrov <oleksandr.pet...@gmail.com> AuthorDate: Thu Jan 24 13:44:55 2019 +0100 Remove unnecessary Runnable wrapping in NamedThreadFactory as is done by Netty. Patch by Alex Petrov; reviewed by Dinesh Joshi for CASSANDRA-15008 --- .../cassandra/concurrent/NamedThreadFactory.java | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java b/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java index 93d0c52..33f1312 100644 --- a/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java +++ b/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java @@ -70,26 +70,6 @@ public class NamedThreadFactory implements ThreadFactory return thread; } - /** - * Ensures that {@link FastThreadLocal#remove() FastThreadLocal.remove()} is called when the {@link Runnable#run()} - * method of the given {@link Runnable} instance completes to ensure cleanup of {@link FastThreadLocal} instances. - * This is especially important for direct byte buffers allocated locally for a thread. - */ - public static Runnable threadLocalDeallocator(Runnable r) - { - return () -> - { - try - { - r.run(); - } - finally - { - FastThreadLocal.removeAll(); - } - }; - } - private static final AtomicInteger threadCounter = new AtomicInteger(); @VisibleForTesting @@ -116,7 +96,7 @@ public class NamedThreadFactory implements ThreadFactory public static Thread createThread(ThreadGroup threadGroup, Runnable runnable, String name, boolean daemon) { String prefix = globalPrefix; - Thread thread = new FastThreadLocalThread(threadGroup, threadLocalDeallocator(runnable), prefix != null ? prefix + name : name); + Thread thread = new FastThreadLocalThread(threadGroup, runnable, prefix != null ? prefix + name : name); thread.setDaemon(daemon); return thread; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org