Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory, and Callable classes defined in this package. This class supports the following kinds of methods:
||public static Callable<Object> callable(Runnable task)
public static <T> Callable<T> callable(Runnable task, T result)
public static Callable<Object> callable(PrivilegedAction<?> action)
public static Callable<Object> callable(PrivilegedExceptionAction<?> action)
|The Callable() method of Executors class returns a Callable object that, when called, runs the given task and returns null.
||public static ThreadFactory defaultThreadFactory()
||The defaultThreadFactory() method of Executors class Returns a default thread factory used to create new threads. This factory creates all new threads used by an Executor in the same ThreadGroup. If there is a SecurityManager, it uses the group of System.
||public static ExecutorService newCachedThreadPool()
public static ExecutorService newCachedThreadPool (ThreadFactory threadFactory)
|The newCachedThreadPool() method of Executors class Creates a thread pool that creates new threads as needed but will reuse previously constructed threads when they are available.
||public static ExecutorService newFixedThreadPool(int nThreads)
public static ExecutorService newFixedThreadPool(int nThreads, ThreadFactory threadFactory)
|The newFixedThreadPool() method of Executors class creates a thread pool that reuses a fixed number of threads operating off a shared unbounded queue. At any point, at most n Threads threads will be active processing tasks. If additional tasks are submitted when all threads are active, they will wait in the queue until a thread is available.
||Public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize)
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, ThreadFactory threadFactory)
|The newScheduledThreadPool() method of Executors class Creates a thread pool that can schedule commands to run after a given delay or to execute periodically.
||public static ExecutorService newSingleThreadExecutor()
public static ExecutorService newSingleThreadExecutor(ThreadFactory threadFactory)
|The newSingleThreadExecutor() method of Executors class creates an Executor that uses a single worker thread operating off an unbounded queue. (Note however that if this single thread terminates due to a failure during execution prior to the shutdown, a new one will take its place if needed to execute subsequent tasks.).
||public static ExecutorService newWorkStealingPool()
public static ExecutorService newWorkStealingPool(int parallelism)
|The newWorkStealingPool() method of Executors class creates a work-stealing thread pool using the number of available processors as its target parallelism level.
||public static ThreadFactory privilegedThreadFactory()
||The privilegedThreadFactory() method of Executors class returns a thread factory used to create new threads that have the same permissions as the current thread. This factory creates threads with the same settings as defaultThreadFactory(), additionally setting the AccessControlContext and contextClassLoader of new threads to be the same as the thread invoking this privilegedThreadFactory method.