public interface Sync extends Future<Void>
This interface allows to synchronize with an operation running on (possibly) a different thread.
Modifier and Type | Method and Description |
---|---|
boolean |
isDone() |
void |
join()
Blocks the current thread until the operation is done.
|
boolean |
join(long timeout,
TimeUnit unit)
Blocks the current thread until the operation is done, or a timeout elapses.
|
cancel, get, get, isCancelled
static final Sync DONE
void join() throws InterruptedException
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.boolean join(long timeout, TimeUnit unit) throws InterruptedException
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