Interface Executor

  • All Implemented Interfaces:
    java.util.concurrent.Executor

    
    public interface Executor
     implements Executor
                        

    Manage async tasks.

    • Constructor Detail

    • Method Detail

      • executeBlocking

         abstract Unit executeBlocking(Duration delay, Function0<Unit> runnable)

        Schedules a blocking task for execution on another thread.

        This method returns immediately, without waiting for the task to finish.

        Parameters:
        delay - the time from now to delay execution
        runnable - the task to run
      • executeBlocking

         abstract Unit executeBlocking(Function0<Unit> runnable)

        Schedules a blocking task for execution on another thread.

        This method returns immediately, without waiting for the task to finish.

        Parameters:
        runnable - the task to run
      • executeBlocking

         abstract <T extends Any> Unit executeBlocking(Callable<T> blocking, Function1<T, Unit> result)

        Execute a task to another thread. If an exception is thrown by the blocking function, null is passed to the result function.

        This method returns immediately, without waiting for the task to finish.

        Parameters:
        blocking - the task to run
        result - the result handler
      • executeBlockingTask

         abstract <T extends Any> CompletableFuture<T> executeBlockingTask(Duration delay, Function0<T> task)

        Schedules a blocking task for execution on another thread.

        This method returns immediately, without waiting for the task to finish.

        The returned future will schedule any followup async task on this executor.

        Parameters:
        delay - the time from now to delay execution
        task - the task to run
        Returns:

        a CompletableFuture that is asynchronously completed with the given task

      • setPeriodic

         Long setPeriodic(Duration delay, Function0<Unit> runnable)

        Schedules a periodic task.

        This method returns immediately, without waiting for the task to execute.

        Parameters:
        delay - the delay before the first call, and between each following call
        runnable - the task to run
      • setPeriodic

         abstract Long setPeriodic(Duration initialDelay, Duration delay, Function0<Unit> runnable)

        Schedules a periodic task.

        This method returns immediately, without waiting for the task to execute.

        Parameters:
        initialDelay - the delay before first call
        delay - the delay between each other call
        runnable - the task to run