Package org.jboss.jca.web
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.ThreadPoolAn 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
-
-
Constructor Summary
Constructors Constructor Description ExecutorThreadPool(ExecutorService executor)Constrcutor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandispatch(Runnable job)Dispatch a jobprotected voiddoStart()Startprotected voiddoStop()StopintgetIdleThreads()Get the number of idle threadsintgetThreads()Get the number of threadsbooleanisLowOnThreads()Is the pool low on threads ?voidjoin()Join - await termination of pool
-
-
-
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:
dispatchin interfaceorg.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:
getIdleThreadsin interfaceorg.eclipse.jetty.util.thread.ThreadPool- Returns:
- The number; -1 if not supported
-
getThreads
public int getThreads()
Get the number of threads- Specified by:
getThreadsin interfaceorg.eclipse.jetty.util.thread.ThreadPool- Returns:
- The number; -1 if not supported
-
isLowOnThreads
public boolean isLowOnThreads()
Is the pool low on threads ?- Specified by:
isLowOnThreadsin interfaceorg.eclipse.jetty.util.thread.ThreadPool- Returns:
- True if active threads >= maximum number of threads
-
join
public void join() throws InterruptedExceptionJoin - await termination of pool- Specified by:
joinin interfaceorg.eclipse.jetty.util.thread.ThreadPool- Throws:
InterruptedException- Thrown if interrupted
-
doStart
protected void doStart() throws ExceptionStart- Overrides:
doStartin classorg.eclipse.jetty.util.component.AbstractLifeCycle- Throws:
Exception- Thrown if an error occurs
-
-