Class ThreadPool

java.lang.Object
org.jgroups.util.ThreadPool
All Implemented Interfaces:
Lifecycle

public class ThreadPool extends Object implements Lifecycle
Thread pool based on ThreadPoolExecutor
Since:
5.2
  • Field Details

    • thread_pool

      protected Executor thread_pool
    • log

      protected Log log
    • thread_factory

      protected ThreadFactory thread_factory
    • address

      protected Address address
    • thread_pool_full_log

      protected SuppressLog<String> thread_pool_full_log
    • 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 String rejection_policy
    • thread_pool_full_suppress_time

      protected long thread_pool_full_suppress_time
    • thread_dumps_threshold

      @Deprecated(since="5.4") protected int thread_dumps_threshold
      Deprecated.
    • thread_dump_path

      @Deprecated(since="5.4") protected String thread_dump_path
      Deprecated.
    • thread_dumps_enabled

      protected boolean thread_dumps_enabled
    • increase_max_size_dynamically

      protected boolean increase_max_size_dynamically
    • delta

      protected int delta
    • num_rejected_msgs

      protected final LongAdder num_rejected_msgs
  • Constructor Details

    • ThreadPool

      public ThreadPool()
  • Method Details

    • isEnabled

      public boolean isEnabled()
    • getThreadPool

      public Executor getThreadPool()
    • setThreadPool

      public ThreadPool setThreadPool(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(String policy)
    • getRejectedExecutionHandler

      public RejectedExecutionHandler getRejectedExecutionHandler()
    • setRejectedExecutionHandler

      public void setRejectedExecutionHandler(RejectedExecutionHandler handler)
    • getThreadPoolFullSuppressTime

      public long getThreadPoolFullSuppressTime()
    • setThreadPoolFullSuppressTime

      public ThreadPool setThreadPoolFullSuppressTime(long t)
    • getThreadDumpsEnabled

      public boolean getThreadDumpsEnabled()
    • setThreadDumpsEnabled

      public ThreadPool setThreadDumpsEnabled(boolean b)
    • getThreadDumpsThreshold

      @Deprecated public int getThreadDumpsThreshold()
      Deprecated.
    • setThreadDumpsThreshold

      @Deprecated public ThreadPool setThreadDumpsThreshold(int t)
      Deprecated.
    • 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

      @Deprecated public int getNumberOfThreadDumps()
      Deprecated.
    • resetThreadDumps

      @Deprecated public void resetThreadDumps()
      Deprecated.
    • getThreadPoolSize

      public int getThreadPoolSize()
    • getThreadPoolSizeActive

      public int getThreadPoolSizeActive()
    • getLargestSize

      public int getLargestSize()
    • resetStats

      public void resetStats()
    • init

      public void init() throws Exception
      Description copied from interface: Lifecycle
      Called after an instance has been created and before it is started.
      Specified by:
      init in interface Lifecycle
      Throws:
      Exception - Thrown if the instance cannot be initialized successfully.
    • destroy

      public void destroy()
      Description copied from interface: Lifecycle
      Called after an instance has been stopped. Cleans up resources
      Specified by:
      destroy in interface Lifecycle
    • removeExpired

      public ThreadPool removeExpired()
    • doExecute

      public void doExecute(Runnable task)
    • pool

      public Executor pool()
    • execute

      public boolean execute(Runnable task)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createThreadPool

      protected static ExecutorService createThreadPool(int min_threads, int max_threads, long keep_alive_time, String rejection_policy, BlockingQueue<Runnable> queue, ThreadFactory factory)