java.util.concurrent.Executor, Container, Destroyable, Dumpable, LifeCycle, ThreadPool, ThreadPool.SizedThreadPool, TryExecutorExecutorSizedThreadPool@ManagedObject("A thread pool") public class ExecutorThreadPool extends ContainerLifeCycle implements ThreadPool.SizedThreadPool, TryExecutor
ThreadPool.SizedThreadPool wrapper around ThreadPoolExecutor.AbstractLifeCycle.AbstractLifeCycleListenerContainer.InheritedListener, Container.ListenerLifeCycle.ListenerThreadPool.SizedThreadPoolTryExecutor.NoTryExecutorFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPINGNO_TRY| Constructor | Description |
|---|---|
ExecutorThreadPool() |
|
ExecutorThreadPool(int maxThreads) |
|
ExecutorThreadPool(int maxThreads,
int minThreads) |
|
ExecutorThreadPool(java.util.concurrent.ThreadPoolExecutor executor) |
|
ExecutorThreadPool(java.util.concurrent.ThreadPoolExecutor executor,
int reservedThreads) |
|
ExecutorThreadPool(java.util.concurrent.ThreadPoolExecutor executor,
int reservedThreads,
java.lang.ThreadGroup group) |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
doStart() |
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop() |
Stops the managed lifecycle beans in the reverse order they were added.
|
void |
dump(java.lang.Appendable out,
java.lang.String indent) |
|
void |
execute(java.lang.Runnable command) |
|
int |
getIdleThreads() |
|
int |
getIdleTimeout() |
|
int |
getMaxThreads() |
|
int |
getMinThreads() |
|
java.lang.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. |
protected java.lang.Thread |
newThread(java.lang.Runnable job) |
|
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(java.lang.String name) |
|
void |
setReservedThreads(int reservedThreads) |
Sets the number of reserved threads.
|
void |
setThreadsPriority(int priority) |
|
java.lang.String |
toString() |
|
boolean |
tryExecute(java.lang.Runnable task) |
Attempt to execute a task.
|
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopaddBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitasTryExecutorpublic ExecutorThreadPool()
public ExecutorThreadPool(int maxThreads)
public ExecutorThreadPool(int maxThreads,
int minThreads)
public ExecutorThreadPool(java.util.concurrent.ThreadPoolExecutor executor)
public ExecutorThreadPool(java.util.concurrent.ThreadPoolExecutor executor,
int reservedThreads)
public ExecutorThreadPool(java.util.concurrent.ThreadPoolExecutor executor,
int reservedThreads,
java.lang.ThreadGroup group)
@ManagedAttribute("name of this thread pool") public java.lang.String getName()
public void setName(java.lang.String name)
name - the name of this thread pool, used to name threads@ManagedAttribute("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("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("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("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("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("reports additional details in the dump") public boolean isDetailedDump()
public void setDetailedDump(boolean detailedDump)
@ManagedAttribute("number of threads in the pool") public int getThreads()
getThreads in interface ThreadPool@ManagedAttribute("number of idle threads in the pool") public int getIdleThreads()
getIdleThreads in interface ThreadPoolpublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executorexecute in interface TryExecutorpublic boolean tryExecute(java.lang.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 ThreadPoolprotected void doStart()
throws java.lang.Exception
ContainerLifeCycledoStart in class ContainerLifeCyclejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
ContainerLifeCycledoStop in class ContainerLifeCyclejava.lang.Exceptionpublic void join()
throws java.lang.InterruptedException
ThreadPoolstopped.join in interface ThreadPooljava.lang.InterruptedException - if thread was interruptedpublic ThreadPoolBudget getThreadPoolBudget()
getThreadPoolBudget in interface ThreadPool.SizedThreadPoolprotected java.lang.Thread newThread(java.lang.Runnable job)
public void dump(java.lang.Appendable out,
java.lang.String indent)
throws java.io.IOException
dump in interface Dumpabledump in class ContainerLifeCyclejava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 1995–2018 Webtide. All rights reserved.