|
ModeShape Distribution 3.1.2.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.common.util.ThreadPools
@ThreadSafe public class ThreadPools
A simple ThreadPoolFactory implementation.
| Constructor Summary | |
|---|---|
ThreadPools()
|
|
| Method Summary | |
|---|---|
ExecutorService |
getCachedTreadPool(String name)
Signal that the supplied thread pool is no longer needed. |
ExecutorService |
getScheduledThreadPool(String name)
Obtain a scheduled thread pool with the supplied name, or create and return one if no thread pool exists with that name. |
ExecutorService |
getThreadPool(String name)
Obtain a thread pool with the supplied name, or create and return one if no thread pool exists with that name. |
void |
releaseThreadPool(ExecutorService executor)
Performs a ExecutorService.shutdownNow() on the given pool, if the pool has been created
previously by this class. |
void |
terminateAllPools(long maxWaitTime,
TimeUnit unit)
Terminates all the existing thread pool, by waiting for them maximum maxWaitTimeMillis milliseconds, after which
calling ExecutorService.shutdownNow(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThreadPools()
| Method Detail |
|---|
public ExecutorService getThreadPool(String name)
ThreadPoolFactoryreleased.
getThreadPool in interface ThreadPoolFactoryname - the name of the thread pool; may not be null
public ExecutorService getCachedTreadPool(String name)
ThreadPoolFactoryreleased.
getCachedTreadPool in interface ThreadPoolFactoryname - the name of the thread pool; may not be null
public ExecutorService getScheduledThreadPool(String name)
ThreadPoolFactoryreleased.
getScheduledThreadPool in interface ThreadPoolFactoryname - the name of the thread pool; may not be null
public void releaseThreadPool(ExecutorService executor)
ThreadPoolFactoryExecutorService.shutdownNow() on the given pool, if the pool has been created
previously by this class. Clients which use this method should handle, if necessary, any potential
InterruptedException
releaseThreadPool in interface ThreadPoolFactoryexecutor - the pool that is no longer needed
public void terminateAllPools(long maxWaitTime,
TimeUnit unit)
ThreadPoolFactorymaxWaitTimeMillis milliseconds, after which
calling ExecutorService.shutdownNow().
terminateAllPools in interface ThreadPoolFactorymaxWaitTime - the maximum amount of time that should be given to the pools to shutdown on their own; must be
non-negativeunit - the unit of time for the maxWaitTime parameter
|
ModeShape Distribution 3.1.2.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||