Interface ThreadPool

  • All Known Implementing Classes:
    BasicThreadPool

    public interface ThreadPool
    A thread pool.
    Version:
    $Revision$
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void run​(java.lang.Runnable runnable)
      Run a runnable
      void run​(java.lang.Runnable runnable, long startTimeout, long completeTimeout)
      Run runnable with start and complete time out set explicitely.
      void runTask​(Task task)
      Run a task
      void runTaskWrapper​(TaskWrapper wrapper)
      Run a task wrapper
      void stop​(boolean immediate)
      Stop the pool
      void waitForTasks()
      Wait on the queued tasks to complete.
      void waitForTasks​(long maxWaitTime)
      Wait on the queued tasks to complete upto maxWaitTime milliseconds.
    • Method Detail

      • stop

        void stop​(boolean immediate)
        Stop the pool
        Parameters:
        immediate - whether to shutdown immediately
      • waitForTasks

        void waitForTasks()
                   throws java.lang.InterruptedException
        Wait on the queued tasks to complete. This can only be called after stop.
        Throws:
        java.lang.InterruptedException - for any iterruption error
      • waitForTasks

        void waitForTasks​(long maxWaitTime)
                   throws java.lang.InterruptedException
        Wait on the queued tasks to complete upto maxWaitTime milliseconds. This can only be called after stop.
        Parameters:
        maxWaitTime - the max wait time
        Throws:
        java.lang.InterruptedException - for any interruption error
      • runTaskWrapper

        void runTaskWrapper​(TaskWrapper wrapper)
        Run a task wrapper
        Parameters:
        wrapper - the task wrapper
      • runTask

        void runTask​(Task task)
        Run a task
        Parameters:
        task - the task
        Throws:
        java.lang.IllegalArgumentException - for a null task
      • run

        void run​(java.lang.Runnable runnable)
        Run a runnable
        Parameters:
        runnable - the runnable
        Throws:
        java.lang.IllegalArgumentException - for a null runnable
      • run

        void run​(java.lang.Runnable runnable,
                 long startTimeout,
                 long completeTimeout)
        Run runnable with start and complete time out set explicitely.
        Parameters:
        runnable - the runnable
        startTimeout - the start timeout
        completeTimeout - the complete timeout
        Throws:
        java.lang.IllegalArgumentException - for a null runnable