Interface ThreadPool

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    ThreadPoolImpl

    public interface ThreadPool
    extends java.io.Closeable
    This interface defines a thread pool execution service. The ORB uses this interface, which preceeds the JDK 5 ExecutorService. Note that the close method must be called in order to reclaim thread resources.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long averageWorkCompletionTime()
      This method returns the average elapsed time taken to complete a Work item.
      int currentNumberOfThreads()
      This method will return the current number of threads in the threadpool.
      long currentProcessedCount()
      This method returns the number of Work items processed by the threadpool
      WorkQueue getAnyWorkQueue()
      This method will return any instance of the WorkQueue.
      java.lang.String getName()
      This method will return the name of the threadpool.
      WorkQueue getWorkQueue​(int queueId)
      This method will return an instance of the of the WorkQueue given a queueId.
      long idleTimeoutForThreads()
      This method will return the time in milliseconds when idle threads in the threadpool are removed.
      int maximumNumberOfThreads()
      This method will return the maximum number of threads in the threadpool at any point in time, for the life of the threadpool
      int minimumNumberOfThreads()
      This method will return the minimum number of threads maintained by the threadpool.
      int numberOfAvailableThreads()
      This method will return the number of available threads in the threadpool which are waiting for work.
      int numberOfBusyThreads()
      This method will return the number of busy threads in the threadpool This method returns a value which is not synchronized.
      int numberOfWorkQueues()
      This method will return the number of WorkQueues serviced by the threadpool.
      • Methods inherited from interface java.io.Closeable

        close
    • Method Detail

      • getAnyWorkQueue

        WorkQueue getAnyWorkQueue()
        This method will return any instance of the WorkQueue. If the ThreadPool instance only services one WorkQueue then that WorkQueue instance will be returned. If there are more than one WorkQueues serviced by this ThreadPool, then this method would return a WorkQueue based on the implementation of the class that implements this interface. For PE 8.0 we would return a WorkQueue in a roundrobin fashion everytime this method is called. In the future we could allow pluggability of Policy objects for this.
      • getWorkQueue

        WorkQueue getWorkQueue​(int queueId)
                        throws NoSuchWorkQueueException
        This method will return an instance of the of the WorkQueue given a queueId. This will be useful in situations where there are more than one WorkQueues managed by the ThreadPool and the user of the ThreadPool wants to always use the same WorkQueue for doing the Work. If the number of WorkQueues in the ThreadPool are 10, then queueIds will go from 0-9
        Throws:
        NoSuchWorkQueueException - thrown when queueId passed is invalid
      • numberOfWorkQueues

        int numberOfWorkQueues()
        This method will return the number of WorkQueues serviced by the threadpool.
      • minimumNumberOfThreads

        int minimumNumberOfThreads()
        This method will return the minimum number of threads maintained by the threadpool.
      • maximumNumberOfThreads

        int maximumNumberOfThreads()
        This method will return the maximum number of threads in the threadpool at any point in time, for the life of the threadpool
      • idleTimeoutForThreads

        long idleTimeoutForThreads()
        This method will return the time in milliseconds when idle threads in the threadpool are removed.
      • currentNumberOfThreads

        int currentNumberOfThreads()
        This method will return the current number of threads in the threadpool. This method returns a value which is not synchronized.
      • numberOfAvailableThreads

        int numberOfAvailableThreads()
        This method will return the number of available threads in the threadpool which are waiting for work. This method returns a value which is not synchronized.
      • numberOfBusyThreads

        int numberOfBusyThreads()
        This method will return the number of busy threads in the threadpool This method returns a value which is not synchronized.
      • currentProcessedCount

        long currentProcessedCount()
        This method returns the number of Work items processed by the threadpool
      • averageWorkCompletionTime

        long averageWorkCompletionTime()
        This method returns the average elapsed time taken to complete a Work item.
      • getName

        java.lang.String getName()
        This method will return the name of the threadpool.