Class ExecutionService

    • Field Detail

      • threadpool

        protected IThreadPool threadpool
        The threadpool.
      • executors

        protected java.util.Map<IExecutable,​Executor> executors
        The currently waiting tasks (task->executor).
      • idlefuture

        protected Future<java.lang.Void> idlefuture
        The idle future.
      • runningexes

        protected java.util.Map<IExecutable,​Executor> runningexes
        The running (i.e. non-blocked) executors.
    • Method Detail

      • execute

        public void execute​(IExecutable task)
        Execute a task in its own thread.
        Specified by:
        execute in interface IExecutionService
        Parameters:
        task - The task to execute. (called from arbitrary threads)
      • cancel

        public IFuture<java.lang.Void> cancel​(IExecutable task)
        Cancel a task. Triggers the task to be not executed in future.
        Specified by:
        cancel in interface IExecutionService
        Parameters:
        task - The task to execute.
        listener - The listener.
        Returns:
        Future signaling cancellation.
      • startService

        public IFuture<java.lang.Void> startService()
        Start the execution service. Resumes all scheduled tasks.
        Specified by:
        startService in interface IInternalService
        Returns:
        A future that is done when the service has completed starting.
      • shutdownService

        public IFuture<java.lang.Void> shutdownService()
        Shutdown the executor service. // todo: make callable more than once
        Specified by:
        shutdownService in interface IInternalService
        Returns:
        A future that is done when the service has completed its shutdown.
      • customIsValid

        public boolean customIsValid()
        Test if the service is valid.
        Returns:
        True, if service can be used.