Package com.biglybt.core.util
Class ThreadPool<T extends AERunnable>
java.lang.Object
com.biglybt.core.util.ThreadPool<T>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<ThreadPool<T>.threadPoolWorker> private static boolean
private static final List
<ThreadPool<?>> private int
private static boolean
private static boolean
private long
private boolean
private static final boolean
private final String
private static final boolean
private final boolean
private int
private final Average
private long
private long
private int
private int
private final AESemaphore
(package private) static final ThreadLocal
private static final int
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionThreadPool
(String _name, int _max_size) ThreadPool
(String _name, int _max_size, boolean _queue_when_full) -
Method Summary
Modifier and TypeMethodDescriptionprotected static void
protected void
protected void
void
private void
generateEvidence
(IndentWriter writer) int
getName()
int
int
boolean
isFull()
boolean
isQueued
(AERunnable task) void
registerThreadAsChild
(ThreadPool<T>.threadPoolWorker parent) (package private) void
releaseManual
(ThreadPoolTask toRelease) protected void
runIt
(AERunnable runnable) void
setExecutionLimit
(long millis) void
void
setMaxThreads
(int max) void
setThreadPriority
(int _priority) void
-
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
-
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
-
name
-
thread_name_index
private int thread_name_index -
execution_limit
private long execution_limit -
busy
-
queue_when_full
private final boolean queue_when_full -
task_queue
-
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
-
log_cpu
private boolean log_cpu
-
-
Constructor Details
-
ThreadPool
-
ThreadPool
-
-
Method Details
-
checkAllTimeouts
protected static void checkAllTimeouts() -
generateEvidence
-
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
-
run
- Parameters:
runnable
-high_priority
- inserts at front if tasks queueing
-
runIt
-
checkWarning
protected void checkWarning() -
getQueuedTasks
-
getOldestQueuedTask
-
getQueueSize
public int getQueueSize() -
isQueued
-
getRunningTasks
-
getRunningCount
public int getRunningCount() -
isFull
public boolean isFull() -
setMaxThreads
public void setMaxThreads(int max) -
checkTimeouts
protected void checkTimeouts() -
getName
-
releaseManual
-
registerThreadAsChild
-
deregisterThreadAsChild
-