org.mortbay.jetty.j2se6
Class ThreadPoolExecutorAdapter
java.lang.Object
org.mortbay.jetty.j2se6.ThreadPoolExecutorAdapter
- All Implemented Interfaces:
- LifeCycle, ThreadPool
public class ThreadPoolExecutorAdapter
- extends java.lang.Object
- implements ThreadPool, LifeCycle
Jetty ThreadPool
that bridges requests to a ThreadPoolExecutor
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThreadPoolExecutorAdapter
public ThreadPoolExecutorAdapter(java.util.concurrent.ThreadPoolExecutor executor)
dispatch
public boolean dispatch(java.lang.Runnable job)
- Specified by:
dispatch
in interface ThreadPool
getIdleThreads
public int getIdleThreads()
- Specified by:
getIdleThreads
in interface ThreadPool
- Returns:
- The number of idle threads in the pool
getThreads
public int getThreads()
- Specified by:
getThreads
in interface ThreadPool
- Returns:
- The total number of threads currently in the pool
isLowOnThreads
public boolean isLowOnThreads()
- Specified by:
isLowOnThreads
in interface ThreadPool
- 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 is
stopped
.
- Specified by:
join
in interface ThreadPool
- Throws:
java.lang.InterruptedException
isFailed
public boolean isFailed()
- Specified by:
isFailed
in interface LifeCycle
- Returns:
- true if the component has failed to start or has failed to stop.
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interface LifeCycle
- Returns:
- true if the component is starting or has been started.
isStarted
public boolean isStarted()
- Specified by:
isStarted
in interface LifeCycle
- Returns:
- true if the component has been started.
- See Also:
LifeCycle.start()
,
LifeCycle.isStarting()
isStarting
public boolean isStarting()
- Specified by:
isStarting
in interface LifeCycle
- Returns:
- true if the component is starting.
- See Also:
LifeCycle.isStarted()
isStopped
public boolean isStopped()
- Specified by:
isStopped
in interface LifeCycle
- Returns:
- true if the component has been stopped.
- See Also:
LifeCycle.stop()
,
LifeCycle.isStopping()
isStopping
public boolean isStopping()
- Specified by:
isStopping
in interface LifeCycle
- Returns:
- true if the component is stopping.
- See Also:
LifeCycle.isStopped()
start
public void start()
throws java.lang.Exception
- Description copied from interface:
LifeCycle
- Starts the component.
- Specified by:
start
in interface LifeCycle
- Throws:
java.lang.Exception
- If the component fails to start- See Also:
LifeCycle.isStarted()
,
LifeCycle.stop()
,
LifeCycle.isFailed()
stop
public void stop()
throws java.lang.Exception
- Description copied from interface:
LifeCycle
- Stops the component.
The component may wait for current activities to complete
normally, but it can be interrupted.
- Specified by:
stop
in interface LifeCycle
- Throws:
java.lang.Exception
- If the component fails to stop- See Also:
LifeCycle.isStopped()
,
LifeCycle.start()
,
LifeCycle.isFailed()
addLifeCycleListener
public void addLifeCycleListener(LifeCycle.Listener listener)
- Specified by:
addLifeCycleListener
in interface LifeCycle
removeLifeCycleListener
public void removeLifeCycleListener(LifeCycle.Listener listener)
- Specified by:
removeLifeCycleListener
in interface LifeCycle
Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.