public interface Sync
This interface allows to synchronize with an operation running on (possibly) a different thread.
static final Sync DONE
void join() throws InterruptedException, SuspendExecution
Blocks the current thread until the operation is done. Upon return, all memory changes done by the operation are visible by the current thread.
InterruptedException
- if this thread is interrupted while blocked.SuspendExecution
boolean join(long timeout, TimeUnit unit) throws InterruptedException, SuspendExecution
Blocks the current thread until the operation is done, or a timeout elapses.
timeout
- The amount of time to wait for the task’s completion.unit
- The time unit for the timeout argument.true
if the operation has completed, or false
if the timeout has elapsed.InterruptedException
SuspendExecution
boolean isDone()
true
if the operation is done, false
otherwise.