Package net.timewalker.ffmq4.utils.async
Class AsyncTaskManager
- java.lang.Object
-
- net.timewalker.ffmq4.utils.async.AsyncTaskManager
-
- All Implemented Interfaces:
AsyncTaskManagerMBean,AsyncTaskProcessorThreadListener,ObjectPoolMBean
public final class AsyncTaskManager extends Object implements AsyncTaskProcessorThreadListener, AsyncTaskManagerMBean
AsyncTaskManager
-
-
Constructor Summary
Constructors Constructor Description AsyncTaskManager(String name, int threadPoolMinSize, int threadPoolMaxIdle, int threadPoolMaxSize)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelTask(AsyncTask task)Cancel a task for the manager queuevoidclose()Close manager resourcesvoidexecute(AsyncTask task)Asynchronously execute the given taskvoidexecutionComplete(AsyncTaskProcessorThread thread)Called on task execution completion by a threadStringgetName()Get the manager nameintgetTaskQueueSize()Get the manager internal queue sizeintgetThreadPoolAvailableCount()intgetThreadPoolExhaustionPolicy()intgetThreadPoolMaxIdle()intgetThreadPoolMaxSize()intgetThreadPoolMinSize()intgetThreadPoolPendingWaits()intgetThreadPoolSize()longgetThreadPoolWaitTimeout()
-
-
-
Constructor Detail
-
AsyncTaskManager
public AsyncTaskManager(String name, int threadPoolMinSize, int threadPoolMaxIdle, int threadPoolMaxSize) throws javax.jms.JMSException
Constructor- Throws:
javax.jms.JMSException
-
-
Method Detail
-
cancelTask
public void cancelTask(AsyncTask task)
Cancel a task for the manager queue- Parameters:
task-
-
execute
public void execute(AsyncTask task) throws javax.jms.JMSException
Asynchronously execute the given task- Throws:
javax.jms.JMSException
-
executionComplete
public void executionComplete(AsyncTaskProcessorThread thread)
Description copied from interface:AsyncTaskProcessorThreadListenerCalled on task execution completion by a thread- Specified by:
executionCompletein interfaceAsyncTaskProcessorThreadListener
-
close
public void close()
Close manager resources
-
getName
public String getName()
Description copied from interface:AsyncTaskManagerMBeanGet the manager name- Specified by:
getNamein interfaceAsyncTaskManagerMBean
-
getTaskQueueSize
public int getTaskQueueSize()
Description copied from interface:AsyncTaskManagerMBeanGet the manager internal queue size- Specified by:
getTaskQueueSizein interfaceAsyncTaskManagerMBean
-
getThreadPoolMaxIdle
public int getThreadPoolMaxIdle()
- Specified by:
getThreadPoolMaxIdlein interfaceObjectPoolMBean- Returns:
- the maxIdle
-
getThreadPoolMinSize
public int getThreadPoolMinSize()
- Specified by:
getThreadPoolMinSizein interfaceObjectPoolMBean- Returns:
- the minSize
-
getThreadPoolMaxSize
public int getThreadPoolMaxSize()
- Specified by:
getThreadPoolMaxSizein interfaceObjectPoolMBean- Returns:
- the maxSize
-
getThreadPoolExhaustionPolicy
public int getThreadPoolExhaustionPolicy()
- Specified by:
getThreadPoolExhaustionPolicyin interfaceObjectPoolMBean- Returns:
- the exhaustionPolicy
-
getThreadPoolWaitTimeout
public long getThreadPoolWaitTimeout()
- Specified by:
getThreadPoolWaitTimeoutin interfaceObjectPoolMBean- Returns:
- the waitTimeout
-
getThreadPoolAvailableCount
public int getThreadPoolAvailableCount()
- Specified by:
getThreadPoolAvailableCountin interfaceObjectPoolMBean- Returns:
- the available count
-
getThreadPoolPendingWaits
public int getThreadPoolPendingWaits()
- Specified by:
getThreadPoolPendingWaitsin interfaceObjectPoolMBean- Returns:
- the pendingWaits
-
getThreadPoolSize
public int getThreadPoolSize()
- Specified by:
getThreadPoolSizein interfaceObjectPoolMBean- Returns:
- the pool size
-
-