-
public class ExecutorUtilsImplements utility functions to facilitate work with Executors and ExecutorService.
-
-
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 reusepreviously constructed threads when they are available. static ScheduledExecutorServicenewScheduledThreadPool(int corePoolSize, boolean daemon, String baseName)Creates a scheduled thread pool, Optionally, the new threads are createdas 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 reusepreviously constructed threads when they are available. Optionally, thenew threads are created as daemon threads and their names are based on aspecific (prefix) string.
- Parameters:
daemon- true to create the new threads as daemon threadsor false to create the new threads as user threadsbaseName- the base/prefix to use for the names of the new threadsor null to leave them with their default names
-
newScheduledThreadPool
static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, boolean daemon, String baseName)
Creates a scheduled thread pool, Optionally, the new threads are createdas 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 threadsor false to create the new threads as user threadsbaseName- the base/prefix to use for the names of the new threadsor null to leave them with their default names
-
-
-
-