Package com.swiftmq.client.thread
Class ThreadPoolImpl
java.lang.Object
com.swiftmq.client.thread.ThreadPoolImpl
- All Implemented Interfaces:
ThreadPool
-
Constructor Summary
ConstructorsConstructorDescriptionThreadPoolImpl
(String poolName, boolean daemonThreads, int minThreads, int maxThreads, int threshold, int addThreads, int priority, long idleTimeout) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the pool.void
dispatchTask
(AsyncTask task) Dispatch a task into the pool.void
freeze
(FreezeCompletionListener listener) Freezes this pool.int
Returns the number of currently idling threads.int
Returns the number of currently running threads.Returns the pool name.void
stop()
Stops the pool.void
unfreeze()
Unfreezes this pool.
-
Constructor Details
-
ThreadPoolImpl
public ThreadPoolImpl(String poolName, boolean daemonThreads, int minThreads, int maxThreads, int threshold, int addThreads, int priority, long idleTimeout)
-
-
Method Details
-
getPoolName
Description copied from interface:ThreadPool
Returns the pool name.- Specified by:
getPoolName
in interfaceThreadPool
- Returns:
- pool name.
-
getNumberRunningThreads
public int getNumberRunningThreads()Description copied from interface:ThreadPool
Returns the number of currently running threads. Used from management tools only.- Specified by:
getNumberRunningThreads
in interfaceThreadPool
- Returns:
- number of running threads.
-
getNumberIdlingThreads
public int getNumberIdlingThreads()Description copied from interface:ThreadPool
Returns the number of currently idling threads. Used from management tools only.- Specified by:
getNumberIdlingThreads
in interfaceThreadPool
- Returns:
- number of idling threads.
-
dispatchTask
Description copied from interface:ThreadPool
Dispatch a task into the pool.- Specified by:
dispatchTask
in interfaceThreadPool
- Parameters:
task
- the task to dispatch.
-
freeze
Description copied from interface:ThreadPool
Freezes 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:
freeze
in interfaceThreadPool
- Parameters:
listener
- will be called when the pool is freezed.
-
unfreeze
public void unfreeze()Description copied from interface:ThreadPool
Unfreezes this pool.- Specified by:
unfreeze
in interfaceThreadPool
-
stop
public void stop()Description copied from interface:ThreadPool
Stops the pool. Internal use only.- Specified by:
stop
in interfaceThreadPool
-
close
public void close()Description copied from interface:ThreadPool
Closes the pool. Internal use only.- Specified by:
close
in interfaceThreadPool
-