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.
A view of something that can be completed with a success or failure.
- Author:
- Julien Viet
-
Method Summary
Modifier and TypeMethodDescriptionvoidComplete this instance whenfailureisnull, a success is signaled otherwise a failure is signaleddefault voidCallsfail(Throwable)with themessage.default voidSet the failure.default voidsucceed()Shortcut forsucceed(null)default voidSet the result.
-
Method Details
-
succeed
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 forsucceed(null)- Throws:
IllegalStateException- when this instance is already completed or failed
-
fail
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
Callsfail(Throwable)with themessage.- Parameters:
message- the failure message- Throws:
IllegalStateException- when this instance is already completed or failed
-
complete
Complete this instance- when
failureisnull, a success is signaled - otherwise a failure is signaled
- Parameters:
result- the resultfailure- the failure- Throws:
IllegalStateException- when this instance is already completed
- when
-