Package org.apache.sling.commons.threads
Interface ThreadPoolManager
-
@ProviderType public interface ThreadPoolManager
TheThreadPoolManager
manages thread pools.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_THREADPOOL_NAME
The default thread pool name
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ThreadPool
create(ThreadPoolConfig config)
Create a new thread pool with this configuration.ThreadPool
create(ThreadPoolConfig config, String label)
Create a new thread pool with this configuration.ThreadPool
get(String name)
Get a thread pool.void
release(ThreadPool pool)
Release the thread pool again.
-
-
-
Field Detail
-
DEFAULT_THREADPOOL_NAME
static final String DEFAULT_THREADPOOL_NAME
The default thread pool name- See Also:
- Constant Field Values
-
-
Method Detail
-
get
ThreadPool get(String name)
Get a thread pool. If there is no thread pool with the given name, a new thread pool with the default configuration is created and returned. A thread pool must be released when not used anymore with therelease(ThreadPool)
method.- Parameters:
name
- The name of the thread pool or null for the default pool.- Returns:
- A thread pool.
-
create
ThreadPool create(ThreadPoolConfig config)
Create a new thread pool with this configuration. A thread pool must be released when not used anymore with therelease(ThreadPool)
method.- Parameters:
config
- The thread pool configuration.- Returns:
- A new thread pool.
-
create
ThreadPool create(ThreadPoolConfig config, String label)
Create a new thread pool with this configuration. A thread pool must be released when not used anymore with therelease(ThreadPool)
method.- Parameters:
config
- The thread pool configuration.label
- An optional label for the thread pool. The label will be appended to the name of the pool.- Returns:
- A new thread pool.
- Since:
- 3.1
-
release
void release(ThreadPool pool)
Release the thread pool again.- Parameters:
pool
- The thread pool to release
-
-