@ManagedObject(value="A thread pool") public class ExecutorThreadPool extends ContainerLifeCycle implements ThreadPool.SizedThreadPool, TryExecutor
ThreadPool.SizedThreadPool wrapper around ThreadPoolExecutor.AbstractLifeCycle.AbstractLifeCycleListenerThreadPool.SizedThreadPoolTryExecutor.NoTryExecutorContainer.InheritedListener, Container.ListenerLifeCycle.ListenerFAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPINGNO_TRY| Constructor and Description |
|---|
ExecutorThreadPool() |
ExecutorThreadPool(int maxThreads) |
ExecutorThreadPool(int maxThreads,
int minThreads) |
ExecutorThreadPool(int maxThreads,
int minThreads,
BlockingQueue<Runnable> queue) |
ExecutorThreadPool(ThreadPoolExecutor executor) |
ExecutorThreadPool(ThreadPoolExecutor executor,
int reservedThreads) |
ExecutorThreadPool(ThreadPoolExecutor executor,
int reservedThreads,
ThreadGroup group) |
| Modifier and Type | Method and Description |
|---|---|
void |
dump(Appendable out,
String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
void |
execute(Runnable command) |
int |
getIdleThreads() |
int |
getIdleTimeout() |
int |
getMaxThreads() |
int |
getMinThreads() |
String |
getName() |
int |
getReservedThreads() |
ThreadPoolBudget |
getThreadPoolBudget() |
int |
getThreads() |
int |
getThreadsPriority() |
boolean |
isDaemon() |
boolean |
isDetailedDump() |
boolean |
isLowOnThreads() |
void |
join()
Blocks until the thread pool is
stopped. |
void |
setDaemon(boolean daemon) |
void |
setDetailedDump(boolean detailedDump) |
void |
setIdleTimeout(int idleTimeout)
Sets the maximum thread idle time in ms.
|
void |
setMaxThreads(int threads) |
void |
setMinThreads(int threads) |
void |
setName(String name) |
void |
setReservedThreads(int reservedThreads)
Sets the number of reserved threads.
|
void |
setThreadsPriority(int priority) |
String |
toString() |
boolean |
tryExecute(Runnable task)
Attempt to execute a task.
|
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopequals, getClass, hashCode, notify, notifyAll, wait, wait, waitasTryExecutordumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, namedpublic ExecutorThreadPool()
public ExecutorThreadPool(int maxThreads)
public ExecutorThreadPool(int maxThreads,
int minThreads)
public ExecutorThreadPool(int maxThreads,
int minThreads,
BlockingQueue<Runnable> queue)
public ExecutorThreadPool(ThreadPoolExecutor executor)
public ExecutorThreadPool(ThreadPoolExecutor executor, int reservedThreads)
public ExecutorThreadPool(ThreadPoolExecutor executor, int reservedThreads, ThreadGroup group)
@ManagedAttribute(value="name of this thread pool") public String getName()
public void setName(String name)
name - the name of this thread pool, used to name threads@ManagedAttribute(value="minimum number of threads in the pool") public int getMinThreads()
getMinThreads in interface ThreadPool.SizedThreadPoolpublic void setMinThreads(int threads)
setMinThreads in interface ThreadPool.SizedThreadPoolthreads - the minimum number of threads@ManagedAttribute(value="maximum number of threads in the pool") public int getMaxThreads()
getMaxThreads in interface ThreadPool.SizedThreadPoolpublic void setMaxThreads(int threads)
setMaxThreads in interface ThreadPool.SizedThreadPoolthreads - the maximum number of threads@ManagedAttribute(value="maximum time a thread may be idle in ms") public int getIdleTimeout()
setIdleTimeout(int)public void setIdleTimeout(int idleTimeout)
Sets the maximum thread idle time in ms.
Threads that are idle for longer than this period may be stopped.
idleTimeout - the maximum thread idle time in ms.getIdleTimeout()@ManagedAttribute(value="the number of reserved threads in the pool") public int getReservedThreads()
setReservedThreads(int)public void setReservedThreads(int reservedThreads)
reservedThreads - number of reserved threads or -1 to determine the number heuristicallygetReservedThreads()public void setThreadsPriority(int priority)
public int getThreadsPriority()
@ManagedAttribute(value="whether this thread pool uses daemon threads") public boolean isDaemon()
setDaemon(boolean)public void setDaemon(boolean daemon)
daemon - whether this thread pool uses daemon threadsThread.setDaemon(boolean)@ManagedAttribute(value="reports additional details in the dump") public boolean isDetailedDump()
public void setDetailedDump(boolean detailedDump)
@ManagedAttribute(value="number of threads in the pool") public int getThreads()
getThreads in interface ThreadPool@ManagedAttribute(value="number of idle threads in the pool") public int getIdleThreads()
getIdleThreads in interface ThreadPoolpublic void execute(Runnable command)
execute in interface Executorexecute in interface TryExecutorpublic boolean tryExecute(Runnable task)
TryExecutortryExecute in interface TryExecutortask - The task to be executed@ManagedAttribute(value="thread pool is low on threads", readonly=true) public boolean isLowOnThreads()
isLowOnThreads in interface ThreadPoolpublic void join()
throws InterruptedException
ThreadPoolstopped.join in interface ThreadPoolInterruptedException - if thread was interruptedpublic ThreadPoolBudget getThreadPoolBudget()
getThreadPoolBudget in interface ThreadPool.SizedThreadPoolpublic void dump(Appendable out, String indent) throws IOException
Dumpabledump in interface Dumpabledump in class ContainerLifeCycleout - The appendable to dump toindent - The indent to apply after any new lines.IOException - if unable to write to Appendablepublic String toString()
toString in class AbstractLifeCycleCopyright © 2010 - 2020 Adobe. All Rights Reserved