Package jadex.commons.concurrent
Class LoadManagingExecutionService
- java.lang.Object
- 
- jadex.commons.concurrent.LoadManagingExecutionService
 
- 
 public class LoadManagingExecutionService extends java.lang.ObjectThis class allows to perform background operations with adjustable CPU utilization.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classLoadManagingExecutionService.TaskA task info holds a task and meta information.
 - 
Field SummaryFields Modifier and Type Field Description protected intconcurrencyThe number of currently running tasks.protected static intCOUNTERThe counter.protected ExecutorexecutorThe executor for performing management operations.protected intlimitA limit for concurrency (to avoid exceeding the timeslice).protected doubleloadThe desired CPU load.protected IThreadPoolpoolThe thread pool.protected longstartThe last start time.protected java.util.SettasksThe tasks to do.protected longtimesliceThe max time slice (in ms).
 - 
Constructor SummaryConstructors Constructor 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.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(IExecutable executable, double priority)Execute a task.static voidmain(java.lang.String[] args)protected voidtaskPerformed(LoadManagingExecutionService.Task task)Called when a task has been performed once.
 
- 
- 
- 
Field Detail- 
poolprotected IThreadPool pool The thread pool.
 - 
loadprotected double load The desired CPU load.
 - 
timesliceprotected long timeslice The max time slice (in ms). Only met if single tasks are below this time.
 - 
tasksprotected java.util.Set tasks The tasks to do.
 - 
executorprotected Executor executor The executor for performing management operations.
 - 
limitprotected int limit A limit for concurrency (to avoid exceeding the timeslice).
 - 
startprotected long start The last start time.
 - 
concurrencyprotected int concurrency The number of currently running tasks.
 - 
COUNTERprotected static int COUNTER The counter.
 
- 
 - 
Constructor Detail- 
LoadManagingExecutionServicepublic LoadManagingExecutionService(IThreadPool pool) Create an execution service with default settings (timeslice=50).
 - 
LoadManagingExecutionServicepublic LoadManagingExecutionService(IThreadPool threadpool, long timeslice) Create an execution service with given settings.
 
- 
 - 
Method Detail- 
executepublic void execute(IExecutable executable, double priority) Execute a task. Triggers the task to be executed in future.- Parameters:
- executable- The task to execute.
- listener- Called when execution has started.
 
 - 
taskPerformedprotected void taskPerformed(LoadManagingExecutionService.Task task) Called when a task has been performed once.
 - 
mainpublic static void main(java.lang.String[] args) 
 
- 
 
-