Interface Executable<T>

  • Type Parameters:
    T - The type this executable is expected to work on
    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 Executable<T>
    A task that returns either a successful or failed result.
    Implementors define a single method with called execute.
    The Executable interface is similar to Runnable and Callable, in that both are designed for classes whose instances are potentially executed by another thread.
    However this class allows the user to respond with either success or failure.
    Since:
    1.2
    See Also:
    Executor
    • Method Detail

      • execute

        void execute​(Promise<T> promise)
        Execute the job.
        Any response needs to be reported via either Promise,success(T) or Promise.failure(Throwable).
        When this method has finished it is imperative that the implementation has reported either failure/success. If not the framework will automatically report the execution as a failure due to a missing response.
        Parameters:
        promise - The promise to report the response to
        Since:
        1.2