java.lang.Object
swim.concurrent.Sync<T>
- All Implemented Interfaces:
ForkJoinPool.ManagedBlocker,Cont<T>
A
Continuation whose completion can be synchronously awaited. A
Sync continuation is used to await the completion of an asynchronous
operation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionawait()Waits an unbounded amount of time for thisSynccontinuation to complete.await(long timeout) Waits a maximum oftimeoutmilliseconds for thisSynccontinuation to complete.voidInvoked when the asynchronous operation completes with avalue.booleanblock()booleanvoidInvoked when the asynchronous operation fails with anerror.
-
Constructor Details
-
Sync
public Sync()Constructs a newSynccontinuation that awaits a value of typeT.
-
-
Method Details
-
isReleasable
public boolean isReleasable()- Specified by:
isReleasablein interfaceForkJoinPool.ManagedBlocker
-
block
- Specified by:
blockin interfaceForkJoinPool.ManagedBlocker- Throws:
InterruptedException
-
bind
Description copied from interface:ContInvoked when the asynchronous operation completes with avalue. -
trap
Description copied from interface:ContInvoked when the asynchronous operation fails with anerror. -
await
Waits a maximum oftimeoutmilliseconds for thisSynccontinuation to complete. Performs a managed block to avoid thread starvation while waiting.- Throws:
SyncException- if thetimeoutmilliseconds elapses and thisSynccontinuation still hasn't been completed.InterruptedException
-
await
Waits an unbounded amount of time for thisSynccontinuation to complete. Performs a managed block to avoid thread starvation while waiting.- Throws:
InterruptedException
-