public class LoadManagingExecutionService
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
LoadManagingExecutionService.Task
A task info holds a task and meta information.
|
Modifier and Type | Field and Description |
---|---|
protected int |
concurrency
The number of currently running tasks.
|
protected static int |
COUNTER
The counter.
|
protected Executor |
executor
The executor for performing management operations.
|
protected int |
limit
A limit for concurrency (to avoid exceeding the timeslice).
|
protected double |
load
The desired CPU load.
|
protected IThreadPool |
pool
The thread pool.
|
protected long |
start
The last start time.
|
protected java.util.Set |
tasks
The tasks to do.
|
protected long |
timeslice
The max time slice (in ms).
|
Constructor and Description |
---|
LoadManagingExecutionService(IThreadPool pool)
Create an execution service with default settings
(timeslice=50).
|
LoadManagingExecutionService(IThreadPool threadpool,
long timeslice)
Create an execution service with given settings.
|
Modifier and Type | Method and Description |
---|---|
void |
execute(IExecutable executable,
double priority)
Execute a task.
|
static void |
main(java.lang.String[] args) |
protected void |
taskPerformed(LoadManagingExecutionService.Task task)
Called when a task has been performed once.
|
protected IThreadPool pool
protected double load
protected long timeslice
protected java.util.Set tasks
protected Executor executor
protected int limit
protected long start
protected int concurrency
protected static int COUNTER
public LoadManagingExecutionService(IThreadPool pool)
public LoadManagingExecutionService(IThreadPool threadpool, long timeslice)
public void execute(IExecutable executable, double priority)
executable
- The task to execute.listener
- Called when execution has started.protected void taskPerformed(LoadManagingExecutionService.Task task)
public static void main(java.lang.String[] args)