Package javascalautils.concurrent
Class Executors
- java.lang.Object
-
- javascalautils.concurrent.Executors
-
public final class Executors extends java.lang.ObjectFactory for creatingExecutorinstances.- Since:
- 1.2
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringExecutorProviderClass
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Executorcreate(java.util.concurrent.Executor threadPool)Creates an executor that uses the provided Java concurrent executor for the actual job processingstatic ExecutorcreateCachedThreadPoolExecutor(java.util.concurrent.ThreadFactory threadFactory)Creates an executor that uses theExecutors.newCachedThreadPool(ThreadFactory).static ExecutorcreateFixedThreadPoolExecutor(int threads, java.util.concurrent.ThreadFactory threadFactory)Creates an executor that uses theExecutors.newFixedThreadPool(int,ThreadFactory)static ExecutorgetDefault()Get the default thread executor.
-
-
-
Field Detail
-
ExecutorProviderClass
public static final java.lang.String ExecutorProviderClass
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefault
public static Executor getDefault()
Get the default thread executor.
Unless specified the default one is created fromcreateCachedThreadPoolExecutor(ThreadFactory).- Returns:
- The default thread executor
- Since:
- 1.3
-
createCachedThreadPoolExecutor
public static Executor createCachedThreadPoolExecutor(java.util.concurrent.ThreadFactory threadFactory)
Creates an executor that uses theExecutors.newCachedThreadPool(ThreadFactory).- Parameters:
threadFactory- The thread factory to use.- Returns:
- An instance of this Executor
- Since:
- 1.2
-
createFixedThreadPoolExecutor
public static Executor createFixedThreadPoolExecutor(int threads, java.util.concurrent.ThreadFactory threadFactory)
Creates an executor that uses theExecutors.newFixedThreadPool(int,ThreadFactory)- Parameters:
threads- The amount of threads to allow in the thread poolthreadFactory- The thread factory to use.- Returns:
- An instance of this Executor
- Since:
- 1.2
-
create
public static Executor create(java.util.concurrent.Executor threadPool)
Creates an executor that uses the provided Java concurrent executor for the actual job processing- Parameters:
threadPool- The java.util.Concurrent executor to use as thread pool- Returns:
- An instance of this Executor
- Since:
- 1.2
-
-