Class ExecutorThreadPool

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.jboss.jca.web.ExecutorThreadPool
All Implemented Interfaces:
org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.util.thread.ThreadPool

public class ExecutorThreadPool extends org.eclipse.jetty.util.component.AbstractLifeCycle implements org.eclipse.jetty.util.thread.ThreadPool
An implementation of the Jetty ThreadPool interface using an ExecutorService
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.ThreadPool

    org.eclipse.jetty.util.thread.ThreadPool.SizedThreadPool
  • Field Summary

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    _listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constrcutor
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Dispatch a job
    protected void
    Start
    protected void
    Stop
    int
    Get the number of idle threads
    int
    Get the number of threads
    boolean
    Is the pool low on threads ?
    void
    Join - await termination of pool

    Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExecutorThreadPool

      public ExecutorThreadPool(ExecutorService executor)
      Constrcutor
      Parameters:
      executor - The executor service
  • Method Details

    • dispatch

      public boolean dispatch(Runnable job)
      Dispatch a job
      Specified by:
      dispatch in interface org.eclipse.jetty.util.thread.ThreadPool
      Parameters:
      job - The job
      Returns:
      True if dispatched; otherwise false
    • getIdleThreads

      public int getIdleThreads()
      Get the number of idle threads
      Specified by:
      getIdleThreads in interface org.eclipse.jetty.util.thread.ThreadPool
      Returns:
      The number; -1 if not supported
    • getThreads

      public int getThreads()
      Get the number of threads
      Specified by:
      getThreads in interface org.eclipse.jetty.util.thread.ThreadPool
      Returns:
      The number; -1 if not supported
    • isLowOnThreads

      public boolean isLowOnThreads()
      Is the pool low on threads ?
      Specified by:
      isLowOnThreads in interface org.eclipse.jetty.util.thread.ThreadPool
      Returns:
      True if active threads >= maximum number of threads
    • join

      public void join() throws InterruptedException
      Join - await termination of pool
      Specified by:
      join in interface org.eclipse.jetty.util.thread.ThreadPool
      Throws:
      InterruptedException - Thrown if interrupted
    • doStart

      protected void doStart() throws Exception
      Start
      Overrides:
      doStart in class org.eclipse.jetty.util.component.AbstractLifeCycle
      Throws:
      Exception - Thrown if an error occurs
    • doStop

      protected void doStop() throws Exception
      Stop
      Overrides:
      doStop in class org.eclipse.jetty.util.component.AbstractLifeCycle
      Throws:
      Exception - Thrown if an error occurs