Interface Task

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Task
    Task.
    • Method Detail

      • builder

        @NotNull
        static @NotNull Task.Builder builder​(@NotNull
                                             @NotNull Runnable runnable)
        Create a new task builder.
        Parameters:
        runnable - Task runnable.
        Returns:
        new builder.
      • sync

        @NotNull
        static @NotNull Task sync​(@NotNull
                                  @NotNull Runnable runnable)
        Create a new synchronous task.
        Parameters:
        runnable - Task runnable.
        Returns:
        new task.
      • async

        @NotNull
        static @NotNull Task async​(@NotNull
                                   @NotNull Runnable runnable)
        Create a new asynchronous task.
        Parameters:
        runnable - Task runnable.
        Returns:
        new task.
      • run

        void run()
        Execute this task.
      • isAsync

        default boolean isAsync()
        Get whether this task should be executed asynchronously.
        Returns:
        asynchronous execution.