Package jadex.concurrent
Class LoadManagingExecutionService
java.lang.Object
jadex.concurrent.LoadManagingExecutionService
This class allows to perform background operations with adjustable
CPU utilization.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
A task info holds a task and meta information. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
The number of currently running tasks.protected static int
The counter.protected Executor
The executor for performing management operations.protected int
A limit for concurrency (to avoid exceeding the timeslice).protected double
The desired CPU load.protected IThreadPool
The thread pool.protected long
The last start time.protected Set
The tasks to do.protected long
The max time slice (in ms). -
Constructor Summary
ConstructorsConstructorDescriptionCreate an execution service with default settings (timeslice=50).LoadManagingExecutionService
(IThreadPool threadpool, long timeslice) Create an execution service with given settings. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(IExecutable executable, double priority) Execute a task.static void
protected void
Called when a task has been performed once.
-
Field Details
-
pool
The thread pool. -
load
protected double loadThe desired CPU load. -
timeslice
protected long timesliceThe max time slice (in ms). Only met if single tasks are below this time. -
tasks
The tasks to do. -
executor
The executor for performing management operations. -
limit
protected int limitA limit for concurrency (to avoid exceeding the timeslice). -
start
protected long startThe last start time. -
concurrency
protected int concurrencyThe number of currently running tasks. -
COUNTER
protected static int COUNTERThe counter.
-
-
Constructor Details
-
LoadManagingExecutionService
Create an execution service with default settings (timeslice=50). -
LoadManagingExecutionService
Create an execution service with given settings.
-
-
Method Details
-
execute
Execute a task. Triggers the task to be executed in future.- Parameters:
executable
- The task to execute.priority
- The priority
-
taskPerformed
Called when a task has been performed once. -
main
-