Class LoadManagingExecutionService


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

      • 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 java.util.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 Detail

      • 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 Detail

      • 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.
        listener - Called when execution has started.
      • main

        public static void main​(java.lang.String[] args)