Class LoadManagingExecutionService

java.lang.Object
jadex.concurrent.LoadManagingExecutionService

public class LoadManagingExecutionService extends Object
This class allows to perform background operations with adjustable CPU utilization.
  • Field Details

    • pool

      protected IThreadPool pool
      The thread pool.
    • load

      protected double load
      The desired CPU load.
    • timeslice

      protected long timeslice
      The max time slice (in ms). Only met if single tasks are below this time.
    • tasks

      protected Set tasks
      The tasks to do.
    • executor

      protected Executor executor
      The executor for performing management operations.
    • limit

      protected int limit
      A limit for concurrency (to avoid exceeding the timeslice).
    • start

      protected long start
      The last start time.
    • concurrency

      protected int concurrency
      The number of currently running tasks.
    • COUNTER

      protected static int COUNTER
      The counter.
  • Constructor Details

    • LoadManagingExecutionService

      public LoadManagingExecutionService(IThreadPool pool)
      Create an execution service with default settings (timeslice=50).
    • LoadManagingExecutionService

      public LoadManagingExecutionService(IThreadPool threadpool, long timeslice)
      Create an execution service with given settings.
  • Method Details

    • execute

      public void execute(IExecutable executable, double priority)
      Execute a task. Triggers the task to be executed in future.
      Parameters:
      executable - The task to execute.
      priority - The priority
    • taskPerformed

      protected void taskPerformed(LoadManagingExecutionService.Task task)
      Called when a task has been performed once.
    • main

      public static void main(String[] args)