Package org.apache.solr.common.util
Class ExecutorUtil
- java.lang.Object
-
- org.apache.solr.common.util.ExecutorUtil
-
public class ExecutorUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ExecutorUtil.InheritableThreadLocalProvider
Any class which wants to carry forward the threadlocal values to the threads run by threadpools must implement this interface and the implementation should be registered herestatic class
ExecutorUtil.MDCAwareThreadPoolExecutor
-
Constructor Summary
Constructors Constructor Description ExecutorUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addThreadLocalProvider(ExecutorUtil.InheritableThreadLocalProvider provider)
static void
awaitTermination(ExecutorService pool)
static boolean
isSolrServerThread()
static ExecutorService
newMDCAwareCachedThreadPool(int maxThreads, ThreadFactory threadFactory)
static ExecutorService
newMDCAwareCachedThreadPool(String name)
Create a cached thread pool using a named thread factorystatic ExecutorService
newMDCAwareCachedThreadPool(ThreadFactory threadFactory)
static ExecutorService
newMDCAwareFixedThreadPool(int nThreads, ThreadFactory threadFactory)
static ExecutorService
newMDCAwareSingleThreadExecutor(ThreadFactory threadFactory)
static void
setServerThreadFlag(Boolean flag)
static void
shutdownAndAwaitTermination(ExecutorService pool)
-
-
-
Method Detail
-
addThreadLocalProvider
public static void addThreadLocalProvider(ExecutorUtil.InheritableThreadLocalProvider provider)
-
shutdownAndAwaitTermination
public static void shutdownAndAwaitTermination(ExecutorService pool)
-
awaitTermination
public static void awaitTermination(ExecutorService pool)
-
newMDCAwareFixedThreadPool
public static ExecutorService newMDCAwareFixedThreadPool(int nThreads, ThreadFactory threadFactory)
-
newMDCAwareSingleThreadExecutor
public static ExecutorService newMDCAwareSingleThreadExecutor(ThreadFactory threadFactory)
-
newMDCAwareCachedThreadPool
public static ExecutorService newMDCAwareCachedThreadPool(String name)
Create a cached thread pool using a named thread factory
-
newMDCAwareCachedThreadPool
public static ExecutorService newMDCAwareCachedThreadPool(ThreadFactory threadFactory)
-
newMDCAwareCachedThreadPool
public static ExecutorService newMDCAwareCachedThreadPool(int maxThreads, ThreadFactory threadFactory)
-
isSolrServerThread
public static boolean isSolrServerThread()
-
setServerThreadFlag
public static void setServerThreadFlag(Boolean flag)
-
-