Package io.vertx.core
Interface Completable<T>
-
- All Known Subinterfaces:
BaseBridgeEvent,BridgeEvent,BridgeEvent,ConnectionInitEvent,Promise<T>
- 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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcomplete(T result, Throwable failure)Complete this instance whenfailureisnull, a success is signaled otherwise a failure is signaleddefault voidfail(String message)Callsfail(Throwable)with themessage.default voidfail(Throwable failure)Set the failure.default voidsucceed()Shortcut forsucceed(null)default voidsucceed(T result)Set the result.
-
-
-
Method Detail
-
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 forsucceed(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)
Callsfail(Throwable)with themessage.- 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
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
-
-