diff --git a/checkstyle.xml b/checkstyle.xml index 8744f2ba1a0..8c0e64b8253 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -5,7 +5,8 @@ - + + diff --git a/pom.xml b/pom.xml index d6c1cfd118e..bb58df0fc6e 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 11 UTF-8 1C - 2.1.1 + 2.1.2 1.4.1.Final 1.0.0.Final 3.20.2 diff --git a/warehouse/core/src/main/java/datawave/iterators/filter/ConfigurableAgeOffFilter.java b/warehouse/core/src/main/java/datawave/iterators/filter/ConfigurableAgeOffFilter.java index 56b0db040bd..4a7df28b713 100644 --- a/warehouse/core/src/main/java/datawave/iterators/filter/ConfigurableAgeOffFilter.java +++ b/warehouse/core/src/main/java/datawave/iterators/filter/ConfigurableAgeOffFilter.java @@ -8,14 +8,15 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.TreeMap; import java.util.concurrent.ExecutionException; -import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import org.apache.accumulo.core.client.PluginEnvironment; -import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.Filter; @@ -23,7 +24,6 @@ import org.apache.accumulo.core.iterators.IteratorUtil; import org.apache.accumulo.core.iterators.OptionDescriber; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; -import org.apache.accumulo.core.util.threads.ThreadPools; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; @@ -33,6 +33,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.LoadingCache; import com.google.common.collect.Lists; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import datawave.ingest.util.cache.ReloadableCacheBuilder; import datawave.ingest.util.cache.watch.FileRuleWatcher; @@ -108,8 +109,10 @@ public class ConfigurableAgeOffFilter extends Filter implements OptionDescriber private static final Logger log = Logger.getLogger(ConfigurableAgeOffFilter.class); - private static final ScheduledThreadPoolExecutor SIMPLE_TIMER = ThreadPools.getServerThreadPools().createScheduledExecutorService(1, - ConfigurableAgeOffFilter.class.getSimpleName() + "-ruleCache-refresh", false); + private static final ThreadFactory TIMER_THREAD_FACTORY = new ThreadFactoryBuilder() + .setNameFormat(ConfigurableAgeOffFilter.class.getSimpleName() + "-ruleCache-refresh-%d").build(); + + private static final ScheduledExecutorService SIMPLE_TIMER = Executors.newSingleThreadScheduledExecutor(TIMER_THREAD_FACTORY); public static final String UPDATE_INTERVAL_MS_PROP = "tserver.datawave.ageoff.cache.update.interval.ms"; protected static final long DEFAULT_UPDATE_INTERVAL_MS = 5; diff --git a/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java b/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java index b0d47f7207d..88a97e31919 100644 --- a/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java +++ b/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java @@ -1,12 +1,12 @@ package datawave.core.iterators; import java.util.Map; -import java.util.Objects; -import java.util.OptionalInt; import java.util.TreeMap; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -14,9 +14,10 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.iterators.IteratorEnvironment; -import org.apache.accumulo.core.util.threads.ThreadPools; import org.apache.log4j.Logger; +import com.google.common.util.concurrent.ThreadFactoryBuilder; + /** * */ @@ -52,7 +53,7 @@ private ThreadPoolExecutor createExecutorService(final String prop, final String } final ThreadPoolExecutor service = createExecutorService(getMaxThreads(prop, pluginEnv), name + " (" + instanceId + ')'); threadPools.put(name, service); - ThreadPools.getServerThreadPools().createGeneralScheduledExecutorService(accumuloConfiguration).scheduleWithFixedDelay(() -> { + Executors.newScheduledThreadPool(getMaxThreads(prop, pluginEnv)).scheduleWithFixedDelay(() -> { try { // Very important to not use the accumuloConfiguration in this thread and instead use the pluginEnv // The accumuloConfiguration caches table ids which may no longer exist down the road. @@ -77,8 +78,8 @@ private ThreadPoolExecutor createExecutorService(final String prop, final String } private ThreadPoolExecutor createExecutorService(int maxThreads, String name) { - ThreadPoolExecutor pool = ThreadPools.getServerThreadPools().createThreadPool(maxThreads, maxThreads, 5 * 60, TimeUnit.SECONDS, name, - new LinkedBlockingQueue<>(), false); + ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat(name + "-%d").build(); + ThreadPoolExecutor pool = new ThreadPoolExecutor(maxThreads, maxThreads, 5, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), tf); pool.allowCoreThreadTimeOut(true); return pool; } diff --git a/warehouse/query-core/src/test/java/datawave/query/iterator/profile/QuerySpanTest.java b/warehouse/query-core/src/test/java/datawave/query/iterator/profile/QuerySpanTest.java index 0d8d8132fe8..31a8ceed01a 100644 --- a/warehouse/query-core/src/test/java/datawave/query/iterator/profile/QuerySpanTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/iterator/profile/QuerySpanTest.java @@ -1,13 +1,15 @@ package datawave.query.iterator.profile; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; -import org.apache.accumulo.core.util.threads.ThreadPools; -import org.apache.accumulo.core.util.threads.Threads; import org.junit.Assert; import org.junit.Test; +import com.google.common.util.concurrent.ThreadFactoryBuilder; + public class QuerySpanTest { @Test @@ -83,8 +85,9 @@ public void testMultiThreadedQuerySpanAcrossThreads() { Runnable r1 = new QSRunnable(qsc, qs1); Runnable r2 = new QSRunnable(qsc, qs2); Runnable r3 = new QSRunnable(qsc, qs3); + ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat("QSExecutor-%d").build(); + ExecutorService executorService = Executors.newFixedThreadPool(10, tf); - ExecutorService executorService = ThreadPools.getClientThreadPools(Threads.UEH).createFixedThreadPool(10, "QSExecutor", false); executorService.execute(r1); executorService.execute(r2); executorService.execute(r3);