public class DwAsyncServiceImpl extends java.lang.Object implements DwAsyncService
Constructor and Description |
---|
DwAsyncServiceImpl(java.lang.Long waitBeforeForcedShutdown) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTerminationForPool(java.lang.String poolToken,
long timeout,
java.util.concurrent.TimeUnit unit)
Blocks until all tasks have completed execution after a shutdown request for
the given pool
|
int |
getActiveCountAll()
Returns the approximately number of active threads in all pools.
|
long |
getCompletedTaskCountAll()
Returns the approximate total number of tasks that have completed execution
summed over all pools.
|
int |
getNrOfPools()
Returns the number of pools
|
DwAsyncPool |
getPool(java.lang.String poolToken)
Returns the pool identified by poolToken or null.
|
long |
getTaskCountAll()
Returns the approximate total number of tasks that have ever been scheduled
for execution summed over all pools.
|
DwAsyncPool |
initPool(java.lang.String poolToken,
PoolConfiguration configuration)
Initializes a new pool for the given configuration.
|
boolean |
isShutdownPool(java.lang.String poolToken)
Returns true if the pool was asked to shutdown.
|
boolean |
isTerminatedPool(java.lang.String poolToken)
Returns true if all tasks have completed following shut down.
|
boolean |
poolExists(java.lang.String poolToken)
Returns true if pool identified by poolToken exists
|
void |
shutdownAll()
Calls shutdown on all pools.
|
java.util.List<java.lang.Runnable> |
shutdownAllNow()
Calls shutdownNow on all pools.
|
java.util.List<java.lang.Runnable> |
shutdownNowDefault()
Terminates the default thread pool.
|
void |
shutdownPool(java.lang.String poolToken)
If pool exists, the pool is asked to orderly shutdown.
|
java.util.List<java.lang.Runnable> |
shutdownPoolNow(java.lang.String poolToken)
If pool exists, the pool is shutdown immediately.
|
void |
submit(java.lang.Runnable task)
Submits a task to be run on the default thread pool
|
void |
suhtdownDefault()
Shuts down the default thread pool
|
public DwAsyncServiceImpl(java.lang.Long waitBeforeForcedShutdown)
public void shutdownAll()
DwAsyncService
shutdownAll
in interface DwAsyncService
DwAsyncPool.shutdown()
public java.util.List<java.lang.Runnable> shutdownAllNow()
DwAsyncService
shutdownAllNow
in interface DwAsyncService
DwAsyncPool.shutdownNow()
public boolean poolExists(java.lang.String poolToken)
DwAsyncService
poolExists
in interface DwAsyncService
poolToken
- The pool identifierpublic boolean isShutdownPool(java.lang.String poolToken)
DwAsyncService
isShutdownPool
in interface DwAsyncService
ExecutorService.isShutdown()
public boolean isTerminatedPool(java.lang.String poolToken)
DwAsyncService
isTerminatedPool
in interface DwAsyncService
public DwAsyncPool initPool(java.lang.String poolToken, PoolConfiguration configuration)
DwAsyncService
initPool
in interface DwAsyncService
public DwAsyncPool getPool(java.lang.String poolToken)
DwAsyncService
getPool
in interface DwAsyncService
public void shutdownPool(java.lang.String poolToken)
DwAsyncService
shutdownPool
in interface DwAsyncService
ExecutorService.shutdown()
public java.util.List<java.lang.Runnable> shutdownPoolNow(java.lang.String poolToken)
DwAsyncService
shutdownPoolNow
in interface DwAsyncService
ExecutorService.shutdownNow()
public boolean awaitTerminationForPool(java.lang.String poolToken, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
DwAsyncService
awaitTerminationForPool
in interface DwAsyncService
poolToken
- The pool identifierjava.lang.InterruptedException
ExecutorService.awaitTermination(long, TimeUnit)
public int getNrOfPools()
DwAsyncService
getNrOfPools
in interface DwAsyncService
public int getActiveCountAll()
DwAsyncService
getActiveCountAll
in interface DwAsyncService
public long getTaskCountAll()
DwAsyncService
getTaskCountAll
in interface DwAsyncService
public long getCompletedTaskCountAll()
DwAsyncService
getCompletedTaskCountAll
in interface DwAsyncService
public void submit(java.lang.Runnable task)
DwAsyncService
submit
in interface DwAsyncService
public void suhtdownDefault()
DwAsyncService
suhtdownDefault
in interface DwAsyncService
public java.util.List<java.lang.Runnable> shutdownNowDefault()
DwAsyncService
shutdownNowDefault
in interface DwAsyncService