Constructor and Description |
---|
FutureImpl() |
FutureImpl(Object sync) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
void |
failure(Throwable failure)
Notify about the failure, occured during asynchronous operation execution.
|
R |
get() |
R |
get(long timeout,
TimeUnit unit) |
R |
getResult()
Get current result value without any blocking.
|
boolean |
isCancelled() |
boolean |
isDone() |
protected void |
notifyHaveResult()
Notify blocked listeners threads about operation completion.
|
void |
setResult(R result)
Set the result value and notify about operation completion.
|
protected R result
public FutureImpl()
public FutureImpl(Object sync)
public R getResult()
public void setResult(R result)
result
- the result valuepublic boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<R>
public R get() throws InterruptedException, ExecutionException
get
in interface Future<R>
InterruptedException
ExecutionException
public R get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<R>
InterruptedException
ExecutionException
TimeoutException
public void failure(Throwable failure)
failure
- protected void notifyHaveResult()
Copyright © 2021. All rights reserved.