Class ThreadPool<T extends AERunnable>

java.lang.Object
com.biglybt.core.util.ThreadPool<T>

public class ThreadPool<T extends AERunnable> extends Object
  • Field Details

    • NAME_THREADS

      private static final boolean NAME_THREADS
    • LOG_WARNINGS

      private static final boolean LOG_WARNINGS
      See Also:
    • WARN_TIME

      private static final int WARN_TIME
      See Also:
    • busy_pools

      private static final List<ThreadPool<?>> busy_pools
    • busy_pool_timer_set

      private static boolean busy_pool_timer_set
    • debug_thread_pool

      private static boolean debug_thread_pool
    • debug_thread_pool_log_on

      private static boolean debug_thread_pool_log_on
    • tls

      static final ThreadLocal tls
    • name

      private final String name
    • thread_name_index

      private int thread_name_index
    • execution_limit

      private long execution_limit
    • busy

      private final List<ThreadPool<T extends AERunnable>.threadPoolWorker> busy
    • queue_when_full

      private final boolean queue_when_full
    • task_queue

      private final List<T extends AERunnable> task_queue
    • thread_sem

      private final AESemaphore thread_sem
    • target_permits

      private int target_permits
    • current_permits

      private int current_permits
    • thread_priority

      private int thread_priority
    • warn_when_full

      private boolean warn_when_full
    • task_total

      private long task_total
    • task_total_last

      private long task_total_last
    • task_average

      private final Average task_average
    • log_cpu

      private boolean log_cpu
  • Constructor Details

    • ThreadPool

      public ThreadPool(String _name, int _max_size)
    • ThreadPool

      public ThreadPool(String _name, int _max_size, boolean _queue_when_full)
  • Method Details

    • checkAllTimeouts

      protected static void checkAllTimeouts()
    • generateEvidence

      private void generateEvidence(IndentWriter writer)
    • setWarnWhenFull

      public void setWarnWhenFull()
    • setLogCPU

      public void setLogCPU()
    • getMaxThreads

      public int getMaxThreads()
    • setThreadPriority

      public void setThreadPriority(int _priority)
    • setExecutionLimit

      public void setExecutionLimit(long millis)
    • run

      public ThreadPool<T>.threadPoolWorker run(T runnable)
    • run

      public ThreadPool<T>.threadPoolWorker run(T runnable, boolean high_priority, boolean manualRelease)
      Parameters:
      runnable -
      high_priority - inserts at front if tasks queueing
    • runIt

      protected void runIt(AERunnable runnable)
    • checkWarning

      protected void checkWarning()
    • getQueuedTasks

      public AERunnable[] getQueuedTasks()
    • getOldestQueuedTask

      public AERunnable getOldestQueuedTask()
    • getQueueSize

      public int getQueueSize()
    • isQueued

      public boolean isQueued(AERunnable task)
    • getRunningTasks

      public List<T> getRunningTasks()
    • getRunningCount

      public int getRunningCount()
    • isFull

      public boolean isFull()
    • setMaxThreads

      public void setMaxThreads(int max)
    • checkTimeouts

      protected void checkTimeouts()
    • getName

      public String getName()
    • releaseManual

      void releaseManual(ThreadPoolTask toRelease)
    • registerThreadAsChild

      public void registerThreadAsChild(ThreadPool<T>.threadPoolWorker parent)
    • deregisterThreadAsChild

      public void deregisterThreadAsChild(ThreadPool<T>.threadPoolWorker parent)