-
- All Superinterfaces:
Cont<T>
public interface Call<T> extends Cont<T>
Handle used to eventually complete an asynchronous operation by invoking aCont
inuation. ACall
abstracts over the execution context in which aCont
inuation runs. Think of aCall
as a way to asynchronously invokeCont.bind(T)
, andCont#trap(Throwable)
. UseStage.call(Cont)
to get aCall
that asynchronously executes aCont
inuation on an executionStage
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
bind(T value)
Completes thisCall
with avalue
by eventually invoking thebind(T)
method of thisCall
'sCont
inuation.Cont<T>
cont()
Returns theCont
inuation that thisCall
completes.void
trap(Throwable error)
Completes thisCall
with anerror
by eventually invoking thetrap(Throwable)
method of thisCall
'sCont
inuation.boolean
tryBind(T value)
Tries to complete thisCall
with avalue
, returningtrue
if this operation caused the completion of theCall
; returnsfalse
if thisCall
was already completed.boolean
tryTrap(Throwable error)
Tries to complete thisCall
with anerror
, returningtrue
if this operation caused the completion of theCall
; returnsfalse
if thisCall
was already completed.
-
-
-
Method Detail
-
bind
void bind(T value)
Completes thisCall
with avalue
by eventually invoking thebind(T)
method of thisCall
'sCont
inuation.- Specified by:
bind
in interfaceCont<T>
- Throws:
ContException
- if thisCall
has already been completed.
-
trap
void trap(Throwable error)
Completes thisCall
with anerror
by eventually invoking thetrap(Throwable)
method of thisCall
'sCont
inuation.- Specified by:
trap
in interfaceCont<T>
- Throws:
ContException
- if thisCall
has already been completed.
-
tryBind
boolean tryBind(T value)
Tries to complete thisCall
with avalue
, returningtrue
if this operation caused the completion of theCall
; returnsfalse
if thisCall
was already completed. If successful, thebind(T)
method of thisCall
'sCont
inuation will eventually be invoked.
-
tryTrap
boolean tryTrap(Throwable error)
Tries to complete thisCall
with anerror
, returningtrue
if this operation caused the completion of theCall
; returnsfalse
if thisCall
was already completed. If successful, thetrap(Throwable)
method of thisCall
'sCont
inuation will eventually be invoked.
-
-