Package callStack.utils
Class AbstractThreadPool
java.lang.Object
callStack.utils.AbstractThreadPool
- All Implemented Interfaces:
ThreadPoolStats
- Direct Known Subclasses:
CachedThreadPool
public abstract class AbstractThreadPool extends Object implements ThreadPoolStats
-
Field Summary
Fields Modifier and Type Field Description protected ExecutorServicem_pool -
Constructor Summary
Constructors Constructor Description AbstractThreadPool() -
Method Summary
Modifier and Type Method Description intgetActivePoolSize()(U) Returns the number of actively running threads in this thread pool.intgetCurrentPoolSize()(U) Returns the current size of this thread pool.<T> StringgetExceptions(List<Future<T>> futures)Retrieves all Exceptions from the List of Future objects and appends them to a String.intgetMaximumPoolSize()(U) Returns the maximum size of this thread pool.voidshutdown()<T> List<Future<T>>submit(Callable<T> submitMe, int numOfSubmissions)<T> List<Future<T>>submit(List<Callable<T>> listToSubmit)List<String>submitAndGetExceptions(Callable<?> submitMe, int numOfSubmissions)<T> List<String>submitAndGetExceptions(List<Callable<T>> submitList)<T> List<T>submitAndGetResults(Callable<T> callable, int numOfSubmissions)<T> List<T>submitAndGetResults(List<Callable<T>> listToSubmit)
-
Field Details
-
Constructor Details
-
AbstractThreadPool
public AbstractThreadPool()
-
-
Method Details
-
submitAndGetExceptions
-
submitAndGetExceptions
-
submit
-
submit
-
submitAndGetResults
-
submitAndGetResults
-
shutdown
public void shutdown() -
getExceptions
Retrieves all Exceptions from the List of Future objects and appends them to a String. Note: will halt the calling thread till all the futures/threads are completed.- Parameters:
futures- list of futures to invoke- Returns:
- a String containing all Exceptions thrown from the Future tasks
-
getMaximumPoolSize
public int getMaximumPoolSize()(U) Returns the maximum size of this thread pool. Some implementations of the underlying Executor may not expose the thread pool sizes. If this occurs, zero will be returned.- Specified by:
getMaximumPoolSizein interfaceThreadPoolStats- Returns:
- The maximum size of this thread pool.
-
getCurrentPoolSize
public int getCurrentPoolSize()(U) Returns the current size of this thread pool. Some implementations of the underlying Executor may not expose the thread pool sizes. If this occurs, zero will be returned.- Specified by:
getCurrentPoolSizein interfaceThreadPoolStats- Returns:
- The current size of this thread pool.
-
getActivePoolSize
public int getActivePoolSize()(U) Returns the number of actively running threads in this thread pool. Some implementations of the underlying Executor may not expose the thread pool sizes. If this occurs, zero will be returned.- Specified by:
getActivePoolSizein interfaceThreadPoolStats- Returns:
- The active size of this thread pool.
-