Package 

Interface Executor


  • 
    public interface Executor
    
                        

    Manage async tasks.

    • Method Summary

      Modifier and Type Method Description
      abstract Unit executeBlocking(Duration delay, Function0<Unit> runnable) Execute a task to another thread.
      abstract Unit executeBlocking(Function0<Unit> runnable) Execute a task to another thread.
      abstract <T extends Any> Unit executeBlocking(Callable<T> blocking, Function1<T, Unit> result) Execute a task to another thread.
      Long setPeriodic(Duration delay, Function0<Unit> runnable) Execute a periodic task.
      abstract Long setPeriodic(Duration initialDelay, Duration delay, Function0<Unit> runnable) Execute a periodic task.
      • Methods inherited from class ai.tock.shared.Executor

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • executeBlocking

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

        Execute a task to another thread.

        Parameters:
        runnable - the task to run
      • executeBlocking

         abstract Unit executeBlocking(Function0<Unit> runnable)

        Execute a task to another thread.

        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.

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

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

        Execute a periodic task.

        Parameters:
        delay - the delay between each other call
        runnable - the task to run
      • setPeriodic

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

        Execute a periodic task.

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