Interface ThreadPool

  • All Known Implementing Classes:
    SimpleThreadPool

    public interface ThreadPool

    ThreadPool specifies basic thread-pooling operations such that third-party implementations may be used without requiring changes to BioJava.

    Since:
    1.3
    Author:
    Keith James
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addRequest​(Runnable task)
      addRequest requests that a Runnable be scheduled to be run by one of the threads in the pool.
      void startThreads()
      startThreads starts all the threads running and opens the pool to requests.
      void stopThreads()
      stopThreads causes all running threads to stop when their current task is complete.
      void waitForThreads()
      waitForThreads temporarily closes the pool to new requests until such time as the current request queue has been emptied and all running tasks completed.
    • Method Detail

      • addRequest

        void addRequest​(Runnable task)
        addRequest requests that a Runnable be scheduled to be run by one of the threads in the pool.
        Parameters:
        task - a Runnable.
      • startThreads

        void startThreads()
        startThreads starts all the threads running and opens the pool to requests.
      • stopThreads

        void stopThreads()
        stopThreads causes all running threads to stop when their current task is complete. It also closes the pool to new requests. Requests still queued are not done and the queue is emptied.
      • waitForThreads

        void waitForThreads()
        waitForThreads temporarily closes the pool to new requests until such time as the current request queue has been emptied and all running tasks completed.