Package net.datenwerke.async
Class DwAsyncServiceImpl
java.lang.Object
net.datenwerke.async.DwAsyncServiceImpl
- All Implemented Interfaces:
DwAsyncService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTerminationForPool(String poolToken, long timeout, TimeUnit unit) Blocks until all tasks have completed execution after a shutdown request for the given poolintReturns the approximately number of active threads in all pools.longReturns the approximate total number of tasks that have completed execution summed over all pools.intReturns the number of poolsReturns the pool identified by poolToken or null.longReturns the approximate total number of tasks that have ever been scheduled for execution summed over all pools.initPool(String poolToken, PoolConfiguration configuration) Initializes a new pool for the given configuration.booleanisShutdownPool(String poolToken) Returns true if the pool was asked to shutdown.booleanisTerminatedPool(String poolToken) Returns true if all tasks have completed following shut down.booleanpoolExists(String poolToken) Returns true if pool identified by poolToken existsvoidCalls shutdown on all pools.Calls shutdownNow on all pools.Terminates the default thread pool.voidshutdownPool(String poolToken) If pool exists, the pool is asked to orderly shutdown.shutdownPoolNow(String poolToken) If pool exists, the pool is shutdown immediately.voidSubmits a task to be run on the default thread poolvoidShuts down the default thread pool
-
Constructor Details
-
DwAsyncServiceImpl
-
-
Method Details
-
shutdownAll
public void shutdownAll()Description copied from interface:DwAsyncServiceCalls shutdown on all pools.- Specified by:
shutdownAllin interfaceDwAsyncService- See Also:
-
shutdownAllNow
Description copied from interface:DwAsyncServiceCalls shutdownNow on all pools.- Specified by:
shutdownAllNowin interfaceDwAsyncService- See Also:
-
poolExists
Description copied from interface:DwAsyncServiceReturns true if pool identified by poolToken exists- Specified by:
poolExistsin interfaceDwAsyncService- Parameters:
poolToken- The pool identifier
-
isShutdownPool
Description copied from interface:DwAsyncServiceReturns true if the pool was asked to shutdown.- Specified by:
isShutdownPoolin interfaceDwAsyncService- Parameters:
poolToken-- See Also:
-
isTerminatedPool
Description copied from interface:DwAsyncServiceReturns true if all tasks have completed following shut down.- Specified by:
isTerminatedPoolin interfaceDwAsyncService- Parameters:
poolToken-
-
initPool
Description copied from interface:DwAsyncServiceInitializes a new pool for the given configuration. If a pool for poolToken already exists, the old pool is terminated.- Specified by:
initPoolin interfaceDwAsyncService- Parameters:
poolToken-configuration-- Returns:
- The pool
-
getPool
Description copied from interface:DwAsyncServiceReturns the pool identified by poolToken or null.- Specified by:
getPoolin interfaceDwAsyncService- Parameters:
poolToken-
-
shutdownPool
Description copied from interface:DwAsyncServiceIf pool exists, the pool is asked to orderly shutdown.- Specified by:
shutdownPoolin interfaceDwAsyncService- Parameters:
poolToken-- See Also:
-
shutdownPoolNow
Description copied from interface:DwAsyncServiceIf pool exists, the pool is shutdown immediately.- Specified by:
shutdownPoolNowin interfaceDwAsyncService- Parameters:
poolToken-- Returns:
- list of tasks that never commenced execution
- See Also:
-
awaitTerminationForPool
public boolean awaitTerminationForPool(String poolToken, long timeout, TimeUnit unit) throws InterruptedException Description copied from interface:DwAsyncServiceBlocks until all tasks have completed execution after a shutdown request for the given pool- Specified by:
awaitTerminationForPoolin interfaceDwAsyncService- Parameters:
poolToken- The pool identifiertimeout-unit-- Throws:
InterruptedException- See Also:
-
getNrOfPools
public int getNrOfPools()Description copied from interface:DwAsyncServiceReturns the number of pools- Specified by:
getNrOfPoolsin interfaceDwAsyncService- Returns:
- the number of pools
-
getActiveCountAll
public int getActiveCountAll()Description copied from interface:DwAsyncServiceReturns the approximately number of active threads in all pools.- Specified by:
getActiveCountAllin interfaceDwAsyncService- Returns:
- the number of threads
-
getTaskCountAll
public long getTaskCountAll()Description copied from interface:DwAsyncServiceReturns the approximate total number of tasks that have ever been scheduled for execution summed over all pools.- Specified by:
getTaskCountAllin interfaceDwAsyncService- Returns:
- The number of tasks
-
getCompletedTaskCountAll
public long getCompletedTaskCountAll()Description copied from interface:DwAsyncServiceReturns the approximate total number of tasks that have completed execution summed over all pools.- Specified by:
getCompletedTaskCountAllin interfaceDwAsyncService- Returns:
- the number of tasks
-
submit
Description copied from interface:DwAsyncServiceSubmits a task to be run on the default thread pool- Specified by:
submitin interfaceDwAsyncService- Parameters:
task-
-
suhtdownDefault
public void suhtdownDefault()Description copied from interface:DwAsyncServiceShuts down the default thread pool- Specified by:
suhtdownDefaultin interfaceDwAsyncService
-
shutdownNowDefault
Description copied from interface:DwAsyncServiceTerminates the default thread pool.- Specified by:
shutdownNowDefaultin interfaceDwAsyncService
-