public class DelegatingThreadPool extends ContainerLifeCycle implements ThreadPool, TryExecutor
AbstractLifeCycle.AbstractLifeCycleListener
ThreadPool.SizedThreadPool
TryExecutor.NoTryExecutor
Container.InheritedListener, Container.Listener
LifeCycle.Listener
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
NO_TRY
Constructor and Description |
---|
DelegatingThreadPool(java.util.concurrent.Executor executor) |
Modifier and Type | Method and 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 is
stopped . |
void |
setExecutor(java.util.concurrent.Executor executor) |
boolean |
tryExecute(java.lang.Runnable task)
Attempt to execute a task.
|
addBean, 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
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asTryExecutor
dumpObjects, dumpSelf
public DelegatingThreadPool(java.util.concurrent.Executor executor)
public java.util.concurrent.Executor getExecutor()
public void setExecutor(java.util.concurrent.Executor executor)
public void execute(java.lang.Runnable job)
execute
in interface java.util.concurrent.Executor
execute
in interface TryExecutor
public boolean tryExecute(java.lang.Runnable task)
TryExecutor
tryExecute
in interface TryExecutor
task
- The task to be executedpublic int getIdleThreads()
getIdleThreads
in interface ThreadPool
public int getThreads()
getThreads
in interface ThreadPool
public boolean isLowOnThreads()
isLowOnThreads
in interface ThreadPool
public void join() throws java.lang.InterruptedException
ThreadPool
stopped
.join
in interface ThreadPool
java.lang.InterruptedException
- if thread was interruptedprotected void doStop() throws java.lang.Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
java.lang.Exception
Copyright © 1995–2023 Webtide. All rights reserved.