Interface Completable<T>

All Known Subinterfaces:
BaseBridgeEvent, BridgeEvent, BridgeEvent, BridgeEvent, Checkpoint, ConnectionInitEvent, Promise<T>
All Known Implementing Classes:
CountingCheckpoint
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 Completable<T>
A view of something that can be completed with a success or failure.
Author:
Julien Viet
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    complete(T result, Throwable failure)
    Complete this instance when failure is null, a success is signaled otherwise a failure is signaled
    default void
    fail(String message)
    Calls fail(Throwable) with the message.
    default void
    fail(Throwable failure)
    Set the failure.
    default void
    Shortcut for succeed(null)
    default void
    succeed(T result)
    Set the result.
  • Method Details

    • succeed

      default void succeed(T result)
      Set the result. The instance will be marked as succeeded and completed.

      Parameters:
      result - the result
      Throws:
      IllegalStateException - when this instance is already completed or failed
    • succeed

      default void succeed()
      Shortcut for succeed(null)
      Throws:
      IllegalStateException - when this instance is already completed or failed
    • fail

      default void fail(Throwable failure)
      Set the failure. This instance will be marked as failed and completed.
      Parameters:
      failure - the failure
      Throws:
      IllegalStateException - when this instance is already completed or failed
    • fail

      default void fail(String message)
      Calls fail(Throwable) with the message.
      Parameters:
      message - the failure message
      Throws:
      IllegalStateException - when this instance is already completed or failed
    • complete

      void complete(T result, Throwable failure)
      Complete this instance
      • when failure is null, a success is signaled
      • otherwise a failure is signaled
      Parameters:
      result - the result
      failure - the failure
      Throws:
      IllegalStateException - when this instance is already completed