- All Known Implementing Classes:
Sync
public interface Cont<T>
Continuation of an asynchronous operation. The
bind(T)
method gets called when the asynchronous operation completes with a
value; the trap(Throwable)
method gets called when the asynchronous
operation fails with an exception.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Runnable
Returns aRunnable
that, when executed, invokes the givencont
inuation with the provided constantvalue
.void
Invoked when the asynchronous operation completes with avalue
.static <X,
T> Cont<X> Returns aCont
inuation that, when completed successfully, completes the givencont
inuation with the provided constantvalue
; and when failed with an error, fails the givencont
inuation with the error.static <T> Cont<T>
ignore()
Returns aCont
continuation that, when completed successfully, does nothing; and when failed with an exception, throws the exception.static boolean
isNonFatal
(Throwable throwable) Returnstrue
ifthrowable
is a recoverable exception; returnsfalse
ifthrowable
cannot be recovered from.void
Invoked when the asynchronous operation fails with anerror
.
-
Method Details
-
bind
Invoked when the asynchronous operation completes with avalue
. -
trap
Invoked when the asynchronous operation fails with anerror
. -
async
Returns aRunnable
that, when executed, invokes the givencont
inuation with the provided constantvalue
. -
constant
Returns aCont
inuation that, when completed successfully, completes the givencont
inuation with the provided constantvalue
; and when failed with an error, fails the givencont
inuation with the error. -
ignore
Returns aCont
continuation that, when completed successfully, does nothing; and when failed with an exception, throws the exception. -
isNonFatal
Returnstrue
ifthrowable
is a recoverable exception; returnsfalse
ifthrowable
cannot be recovered from.
-