@Deprecated public class TaskManager extends Object
This class uses the Logger
named
org.apache.river.thread.TaskManager
to log information at
the following logging levels:
Level | Description |
---|---|
SEVERE | failure to create a worker thread when no other worker threads exist |
WARNING |
exceptions thrown by TaskManager.Task methods, and failure
to create a worker thread when other worker threads exist
|
Modifier and Type | Class and Description |
---|---|
static interface |
TaskManager.Task
Deprecated.
The interface that tasks must implement
|
Modifier and Type | Field and Description |
---|---|
protected int |
firstPending
Deprecated.
Index of the first pending task; all earlier tasks are active
|
protected float |
loadFactor
Deprecated.
Threshold for creating new threads
|
protected static Logger |
logger
Deprecated.
Logger
|
protected int |
maxThreads
Deprecated.
Maximum number of threads allowed
|
protected List |
roTasks
Deprecated.
Read-only view of tasks
|
protected ArrayList<Runnable> |
tasks
Deprecated.
Active and pending tasks
|
protected boolean |
terminated
Deprecated.
True if manager has been terminated
|
protected List |
threads
Deprecated.
Active threads
|
protected long |
timeout
Deprecated.
Idle time before a thread should exit
|
Constructor and Description |
---|
TaskManager()
Deprecated.
Create a task manager with maxThreads = 10, timeout = 15 seconds,
and loadFactor = 3.0.
|
TaskManager(int maxThreads,
long timeout,
float loadFactor)
Deprecated.
Create a task manager.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Runnable t)
Deprecated.
Add a new task.
|
void |
addAll(Collection c)
Deprecated.
Add all tasks in a collection, in iterator order.
|
void |
addIfNew(TaskManager.Task t)
Deprecated.
Add a new task if it is not equal to (using the equals method)
to any existing active or pending task.
|
int |
getMaxThreads()
Deprecated.
Return the maximum number of threads to use on tasks.
|
ArrayList |
getPending()
Deprecated.
Return all pending tasks.
|
protected boolean |
needThread()
Deprecated.
Return true if a new thread should be created (ignoring maxThreads).
|
boolean |
remove(Runnable t)
Deprecated.
|
boolean |
removeIfPending(Runnable t)
Deprecated.
Remove a task if it is pending (not active).
|
void |
terminate()
Deprecated.
Interrupt all threads, and stop processing tasks.
|
protected static final Logger logger
protected int firstPending
protected final List roTasks
protected final List threads
protected final int maxThreads
protected final long timeout
protected final float loadFactor
protected boolean terminated
public TaskManager()
public TaskManager(int maxThreads, long timeout, float loadFactor)
maxThreads
- maximum number of threads to use on taskstimeout
- idle time before a thread exitsloadFactor
- threshold for creating new threads. A new
thread is created if the total number of runnable tasks (both active
and pending) exceeds the number of threads times the loadFactor,
and the maximum number of threads has not been reached.public void addIfNew(TaskManager.Task t)
public void add(Runnable t)
public void addAll(Collection c)
protected boolean needThread()
public boolean removeIfPending(Runnable t)
public boolean remove(Runnable t)
public void terminate()
public ArrayList getPending()
public int getMaxThreads()
Copyright © 2016–2018. All rights reserved.