Package org.jgroups.util
Class ThreadPool
- java.lang.Object
-
- org.jgroups.util.ThreadPool
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanenabledprotected longkeep_alive_timeprotected intmax_threadsprotected intmin_threadsprotected java.lang.Stringthread_dump_pathprotected java.util.concurrent.atomic.AtomicIntegerthread_dumpsprotected intthread_dumps_thresholdprotected java.util.concurrent.Executorthread_poolprotected TPtp
-
Constructor Summary
Constructors Constructor Description ThreadPool(TP tp)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.util.concurrent.ExecutorServicecreateThreadPool(int min_threads, int max_threads, long keep_alive_time, java.lang.String rejection_policy, java.util.concurrent.BlockingQueue<java.lang.Runnable> queue, ThreadFactory factory)voiddestroy()Called after an instance has been stopped.booleanexecute(java.lang.Runnable task)longgetKeepAliveTime()intgetLargestSize()intgetMaxThreads()intgetMinThreads()intgetNumberOfThreadDumps()intgetThreadDumpsThreshold()java.util.concurrent.ExecutorgetThreadPool()intgetThreadPoolSize()intgetThreadPoolSizeActive()voidinit()Called after an instance has been created and before it is started.booleanisShutdown()voidresetThreadDumps()ThreadPoolsetKeepAliveTime(long time)ThreadPoolsetMaxThreads(int size)ThreadPoolsetMinThreads(int size)ThreadPoolsetThreadDumpsThreshold(int t)ThreadPoolsetThreadFactory(ThreadFactory factory)ThreadPoolsetThreadPool(java.util.concurrent.Executor thread_pool)java.lang.StringtoString()
-
-
-
Field Detail
-
thread_pool
protected java.util.concurrent.Executor thread_pool
-
tp
protected final TP tp
-
thread_dumps
protected final java.util.concurrent.atomic.AtomicInteger thread_dumps
-
enabled
protected boolean enabled
-
min_threads
protected int min_threads
-
max_threads
protected int max_threads
-
keep_alive_time
protected long keep_alive_time
-
thread_dumps_threshold
protected int thread_dumps_threshold
-
thread_dump_path
protected java.lang.String thread_dump_path
-
-
Constructor Detail
-
ThreadPool
public ThreadPool(TP tp)
-
-
Method Detail
-
getThreadPool
public java.util.concurrent.Executor getThreadPool()
-
setThreadPool
public ThreadPool setThreadPool(java.util.concurrent.Executor thread_pool)
-
setThreadFactory
public ThreadPool setThreadFactory(ThreadFactory factory)
-
isShutdown
public boolean isShutdown()
-
getMinThreads
public int getMinThreads()
-
setMinThreads
public ThreadPool setMinThreads(int size)
-
getMaxThreads
public int getMaxThreads()
-
setMaxThreads
public ThreadPool setMaxThreads(int size)
-
getKeepAliveTime
public long getKeepAliveTime()
-
setKeepAliveTime
public ThreadPool setKeepAliveTime(long time)
-
getThreadDumpsThreshold
public int getThreadDumpsThreshold()
-
setThreadDumpsThreshold
public ThreadPool setThreadDumpsThreshold(int t)
-
getNumberOfThreadDumps
public int getNumberOfThreadDumps()
-
resetThreadDumps
public void resetThreadDumps()
-
getThreadPoolSize
public int getThreadPoolSize()
-
getThreadPoolSizeActive
public int getThreadPoolSizeActive()
-
getLargestSize
public int getLargestSize()
-
init
public void init() throws java.lang.ExceptionDescription copied from interface:LifecycleCalled after an instance has been created and before it is started.
-
destroy
public void destroy()
Description copied from interface:LifecycleCalled after an instance has been stopped. Cleans up resources
-
execute
public boolean execute(java.lang.Runnable task)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
createThreadPool
protected static java.util.concurrent.ExecutorService createThreadPool(int min_threads, int max_threads, long keep_alive_time, java.lang.String rejection_policy, java.util.concurrent.BlockingQueue<java.lang.Runnable> queue, ThreadFactory factory)
-
-