Package org.jitsi.utils.concurrent
Class ExecutorUtils
-
- All Implemented Interfaces:
public class ExecutorUtilsImplements utility functions to facilitate work with Executors and ExecutorService.
Lyubomir Marinov
-
-
Constructor Summary
Constructors Constructor Description ExecutorUtils()
-
Method Summary
Modifier and Type Method Description static ExecutorServicenewCachedThreadPool(boolean daemon, String baseName)Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. static ScheduledExecutorServicenewScheduledThreadPool(int corePoolSize, boolean daemon, String baseName)Creates a scheduled thread pool, Optionally, the new threads are created as daemon threads and their names are based on a specific (prefix) string. -
-
Method Detail
-
newCachedThreadPool
static ExecutorService newCachedThreadPool(boolean daemon, String baseName)
Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. Optionally, the new threads are created as daemon threads and their names are based on a specific (prefix) string.
- Parameters:
daemon- true to create the new threads as daemon threads or false to create the new threads as user threadsbaseName- the base/prefix to use for the names of the new threads or null to leave them with their default names- Returns:
the newly created thread pool
-
newScheduledThreadPool
static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, boolean daemon, String baseName)
Creates a scheduled thread pool, Optionally, the new threads are created as daemon threads and their names are based on a specific (prefix) string.
- Parameters:
corePoolSize- the number of threads to keep in the pool, even if they are idle.daemon- true to create the new threads as daemon threads or false to create the new threads as user threadsbaseName- the base/prefix to use for the names of the new threads or null to leave them with their default names- Returns:
the newly created thread pool
-
-
-
-