Class 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 Detail

      • ExecutorThreadPool

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

      • 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