Package com.swiftmq.client.thread
Class ThreadPoolImpl
- java.lang.Object
-
- com.swiftmq.client.thread.ThreadPoolImpl
-
- All Implemented Interfaces:
ThreadPool
public class ThreadPoolImpl extends java.lang.Object implements ThreadPool
-
-
Constructor Summary
Constructors Constructor Description ThreadPoolImpl(java.lang.String poolName, boolean daemonThreads, int minThreads, int maxThreads, int threshold, int addThreads, int priority, long idleTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the pool.voiddispatchTask(AsyncTask task)Dispatch a task into the pool.voidfreeze(FreezeCompletionListener listener)Freezes this pool.intgetNumberIdlingThreads()Returns the number of currently idling threads.intgetNumberRunningThreads()Returns the number of currently running threads.java.lang.StringgetPoolName()Returns the pool name.voidstop()Stops the pool.voidunfreeze()Unfreezes this pool.
-
-
-
Method Detail
-
getPoolName
public java.lang.String getPoolName()
Description copied from interface:ThreadPoolReturns the pool name.- Specified by:
getPoolNamein interfaceThreadPool- Returns:
- pool name.
-
getNumberRunningThreads
public int getNumberRunningThreads()
Description copied from interface:ThreadPoolReturns the number of currently running threads. Used from management tools only.- Specified by:
getNumberRunningThreadsin interfaceThreadPool- Returns:
- number of running threads.
-
getNumberIdlingThreads
public int getNumberIdlingThreads()
Description copied from interface:ThreadPoolReturns the number of currently idling threads. Used from management tools only.- Specified by:
getNumberIdlingThreadsin interfaceThreadPool- Returns:
- number of idling threads.
-
dispatchTask
public void dispatchTask(AsyncTask task)
Description copied from interface:ThreadPoolDispatch a task into the pool.- Specified by:
dispatchTaskin interfaceThreadPool- Parameters:
task- the task to dispatch.
-
freeze
public void freeze(FreezeCompletionListener listener)
Description copied from interface:ThreadPoolFreezes this pool. That is, the current running tasks are completed but no further tasks will be scheduled until unfreeze() is called. It is possible to dispatch tasks during freeze. However, these will be executed after unfreeze() is called.- Specified by:
freezein interfaceThreadPool- Parameters:
listener- will be called when the pool is freezed.
-
unfreeze
public void unfreeze()
Description copied from interface:ThreadPoolUnfreezes this pool.- Specified by:
unfreezein interfaceThreadPool
-
stop
public void stop()
Description copied from interface:ThreadPoolStops the pool. Internal use only.- Specified by:
stopin interfaceThreadPool
-
close
public void close()
Description copied from interface:ThreadPoolCloses the pool. Internal use only.- Specified by:
closein interfaceThreadPool
-
-