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 TypeClassDescriptionclassA task info holds a task and meta information. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe number of currently running tasks.protected static intThe counter.protected ExecutorThe executor for performing management operations.protected intA limit for concurrency (to avoid exceeding the timeslice).protected doubleThe desired CPU load.protected IThreadPoolThe thread pool.protected longThe last start time.protected SetThe tasks to do.protected longThe 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 TypeMethodDescriptionvoidexecute(IExecutable executable, double priority) Execute a task.static voidprotected voidCalled 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
-