Package org.jgroups.util
Class ThreadPool
- java.lang.Object
-
- org.jgroups.util.ThreadPool
-
-
Field Summary
Fields Modifier and Type Field Description protected Address
address
protected int
delta
protected boolean
enabled
protected boolean
increase_max_size_dynamically
protected long
keep_alive_time
protected Log
log
protected int
max_threads
protected int
min_threads
protected java.util.concurrent.atomic.LongAdder
num_rejected_msgs
protected java.lang.String
rejection_policy
protected java.lang.String
thread_dump_path
protected java.util.concurrent.atomic.AtomicInteger
thread_dumps
protected int
thread_dumps_threshold
protected ThreadFactory
thread_factory
protected java.util.concurrent.Executor
thread_pool
protected boolean
use_virtual_threads
-
Constructor Summary
Constructors Constructor Description ThreadPool()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
void
destroy()
Called after an instance has been stopped.void
doExecute(java.lang.Runnable task)
boolean
execute(java.lang.Runnable task)
Address
getAddress()
int
getDelta()
boolean
getIncreaseMaxSizeDynamically()
long
getKeepAliveTime()
int
getLargestSize()
int
getMaxThreads()
int
getMinThreads()
int
getNumberOfThreadDumps()
java.util.concurrent.RejectedExecutionHandler
getRejectedExecutionHandler()
int
getThreadDumpsThreshold()
ThreadFactory
getThreadFactory()
java.util.concurrent.Executor
getThreadPool()
int
getThreadPoolSize()
int
getThreadPoolSizeActive()
void
init()
Called after an instance has been created and before it is started.boolean
isEnabled()
boolean
isShutdown()
ThreadPool
log(Log l)
long
numberOfRejectedMessages()
java.util.concurrent.Executor
pool()
void
resetStats()
void
resetThreadDumps()
ThreadPool
setAddress(Address a)
ThreadPool
setDelta(int d)
ThreadPool
setIncreaseMaxSizeDynamically(boolean b)
ThreadPool
setKeepAliveTime(long time)
ThreadPool
setMaxThreads(int size)
ThreadPool
setMinThreads(int size)
void
setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handler)
ThreadPool
setRejectionPolicy(java.lang.String policy)
ThreadPool
setThreadDumpsThreshold(int t)
ThreadPool
setThreadFactory(ThreadFactory factory)
ThreadPool
setThreadPool(java.util.concurrent.Executor thread_pool)
java.lang.String
toString()
boolean
useVirtualThreads()
ThreadPool
useVirtualThreads(boolean b)
-
-
-
Field Detail
-
thread_pool
protected java.util.concurrent.Executor thread_pool
-
log
protected Log log
-
thread_factory
protected ThreadFactory thread_factory
-
address
protected Address address
-
thread_dumps
protected final java.util.concurrent.atomic.AtomicInteger thread_dumps
-
enabled
protected boolean enabled
-
use_virtual_threads
protected boolean use_virtual_threads
-
min_threads
protected int min_threads
-
max_threads
protected int max_threads
-
keep_alive_time
protected long keep_alive_time
-
rejection_policy
protected java.lang.String rejection_policy
-
thread_dumps_threshold
protected int thread_dumps_threshold
-
thread_dump_path
protected java.lang.String thread_dump_path
-
increase_max_size_dynamically
protected boolean increase_max_size_dynamically
-
delta
protected int delta
-
num_rejected_msgs
protected final java.util.concurrent.atomic.LongAdder num_rejected_msgs
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
-
getThreadPool
public java.util.concurrent.Executor getThreadPool()
-
setThreadPool
public ThreadPool setThreadPool(java.util.concurrent.Executor thread_pool)
-
setThreadFactory
public ThreadPool setThreadFactory(ThreadFactory factory)
-
getThreadFactory
public ThreadFactory getThreadFactory()
-
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)
-
setRejectionPolicy
public ThreadPool setRejectionPolicy(java.lang.String policy)
-
getRejectedExecutionHandler
public java.util.concurrent.RejectedExecutionHandler getRejectedExecutionHandler()
-
setRejectedExecutionHandler
public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handler)
-
getThreadDumpsThreshold
public int getThreadDumpsThreshold()
-
setThreadDumpsThreshold
public ThreadPool setThreadDumpsThreshold(int t)
-
getAddress
public Address getAddress()
-
setAddress
public ThreadPool setAddress(Address a)
-
getIncreaseMaxSizeDynamically
public boolean getIncreaseMaxSizeDynamically()
-
setIncreaseMaxSizeDynamically
public ThreadPool setIncreaseMaxSizeDynamically(boolean b)
-
getDelta
public int getDelta()
-
setDelta
public ThreadPool setDelta(int d)
-
numberOfRejectedMessages
public long numberOfRejectedMessages()
-
log
public ThreadPool log(Log l)
-
useVirtualThreads
public boolean useVirtualThreads()
-
useVirtualThreads
public ThreadPool useVirtualThreads(boolean b)
-
getNumberOfThreadDumps
public int getNumberOfThreadDumps()
-
resetThreadDumps
public void resetThreadDumps()
-
getThreadPoolSize
public int getThreadPoolSize()
-
getThreadPoolSizeActive
public int getThreadPoolSizeActive()
-
getLargestSize
public int getLargestSize()
-
resetStats
public void resetStats()
-
init
public void init() throws java.lang.Exception
Description copied from interface:Lifecycle
Called after an instance has been created and before it is started.
-
destroy
public void destroy()
Description copied from interface:Lifecycle
Called after an instance has been stopped. Cleans up resources
-
doExecute
public void doExecute(java.lang.Runnable task)
-
pool
public java.util.concurrent.Executor pool()
-
execute
public boolean execute(java.lang.Runnable task)
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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)
-
-