Package org.eclipse.jetty.http.spi
Class DelegatingThreadPool
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.http.spi.DelegatingThreadPool
-
- All Implemented Interfaces:
java.util.concurrent.Executor
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,ThreadPool
,TryExecutor
public class DelegatingThreadPool extends ContainerLifeCycle implements ThreadPool, TryExecutor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.ThreadPool
ThreadPool.SizedThreadPool
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.TryExecutor
TryExecutor.NoTryExecutor
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
-
Fields inherited from interface org.eclipse.jetty.util.thread.TryExecutor
NO_TRY
-
-
Constructor Summary
Constructors Constructor Description DelegatingThreadPool(java.util.concurrent.Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doStop()
Stops the managed lifecycle beans in the reverse order they were added.void
execute(java.lang.Runnable job)
java.util.concurrent.Executor
getExecutor()
int
getIdleThreads()
int
getThreads()
boolean
isLowOnThreads()
void
join()
Blocks until the thread pool isstopped
.void
setExecutor(java.util.concurrent.Executor executor)
boolean
tryExecute(java.lang.Runnable task)
Attempt to execute a task.-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
-
-
-
Method Detail
-
getExecutor
public java.util.concurrent.Executor getExecutor()
-
setExecutor
public void setExecutor(java.util.concurrent.Executor executor)
-
execute
public void execute(java.lang.Runnable job)
- Specified by:
execute
in interfacejava.util.concurrent.Executor
- Specified by:
execute
in interfaceTryExecutor
-
tryExecute
public boolean tryExecute(java.lang.Runnable task)
Description copied from interface:TryExecutor
Attempt to execute a task.- Specified by:
tryExecute
in interfaceTryExecutor
- Parameters:
task
- The task to be executed- Returns:
- True IFF the task has been given directly to a thread to execute. The task cannot be queued pending the later availability of a Thread.
-
getIdleThreads
public int getIdleThreads()
- Specified by:
getIdleThreads
in interfaceThreadPool
- Returns:
- The number of idle threads in the pool
-
getThreads
public int getThreads()
- Specified by:
getThreads
in interfaceThreadPool
- Returns:
- The total number of threads currently in the pool
-
isLowOnThreads
public boolean isLowOnThreads()
- Specified by:
isLowOnThreads
in interfaceThreadPool
- Returns:
- True if the pool is low on threads
-
join
public void join() throws java.lang.InterruptedException
Description copied from interface:ThreadPool
Blocks until the thread pool isstopped
.- Specified by:
join
in interfaceThreadPool
- Throws:
java.lang.InterruptedException
- if thread was interrupted
-
doStop
protected void doStop() throws java.lang.Exception
Description copied from class:ContainerLifeCycle
Stops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStop
in classContainerLifeCycle
- Throws:
java.lang.Exception
-
-