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 Details

  • Constructor Details

  • Method Details

    • submitAndGetExceptions

      public List<String> submitAndGetExceptions​(Callable<?> submitMe, int numOfSubmissions)
    • submitAndGetExceptions

      public <T> List<String> submitAndGetExceptions​(List<Callable<T>> submitList)
    • submit

      public <T> List<Future<T>> submit​(Callable<T> submitMe, int numOfSubmissions)
    • submit

      public <T> List<Future<T>> submit​(List<Callable<T>> listToSubmit)
    • submitAndGetResults

      public <T> List<T> submitAndGetResults​(List<Callable<T>> listToSubmit)
    • submitAndGetResults

      public <T> List<T> submitAndGetResults​(Callable<T> callable, int numOfSubmissions)
    • shutdown

      public void shutdown()
    • getExceptions

      public <T> String getExceptions​(List<Future<T>> futures)
      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:
      getMaximumPoolSize in interface ThreadPoolStats
      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:
      getCurrentPoolSize in interface ThreadPoolStats
      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:
      getActivePoolSize in interface ThreadPoolStats
      Returns:
      The active size of this thread pool.