public final class ReadyFutureImpl<R> extends Object implements FutureImpl<R>
Future
implementation with the specific unmodifiable result.Future
Modifier and Type | Method and Description |
---|---|
void |
addCompletionHandler(CompletionHandler<R> completionHandler)
Adds a
CompletionHandler , which will be notified once the
asynchronous computation, represented by this Future,
is complete. |
boolean |
cancel(boolean mayInterruptIfRunning)
Do nothing.
|
static <R> ReadyFutureImpl<R> |
create()
Construct cancelled
Future . |
static <R> ReadyFutureImpl<R> |
create(R result)
Construct
Future with the result. |
static <R> ReadyFutureImpl<R> |
create(Throwable failure)
Construct failed
Future . |
void |
failure(Throwable failure)
Should not be called for ReadyFutureImpl
|
R |
get() |
R |
get(long timeout,
TimeUnit unit) |
R |
getResult()
Get current result value without any blocking.
|
boolean |
isCancelled() |
boolean |
isDone() |
void |
markForRecycle(boolean recycleResult)
Mark GrizzlyFuture as recyclable, so once result will come -
GrizzlyFuture object will be recycled and returned to a
thread local object pool.
|
void |
recycle() |
void |
recycle(boolean recycleResult)
Recycle GrizzlyFuture now.
|
void |
result(R result)
Set the result value and notify about operation completion.
|
void |
setResult(R result)
Should not be called for ReadyFutureImpl
|
protected R result
public static <R> ReadyFutureImpl<R> create()
Future
.public static <R> ReadyFutureImpl<R> create(R result)
Future
with the result.public static <R> ReadyFutureImpl<R> create(Throwable failure)
Future
.public void addCompletionHandler(CompletionHandler<R> completionHandler)
CompletionHandler
, which will be notified once the
asynchronous computation, represented by this Future,
is complete.addCompletionHandler
in interface GrizzlyFuture<R>
completionHandler
- CompletionHandler
public R getResult()
getResult
in interface FutureImpl<R>
public void setResult(R result)
public 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
in interface FutureImpl<R>
public void result(R result)
FutureImpl
result
in interface FutureImpl<R>
result
- the result valuepublic void markForRecycle(boolean recycleResult)
GrizzlyFuture
markForRecycle
in interface GrizzlyFuture<R>
recycleResult
- if true - the GrizzlyFuture result,
if it support recyclable mechanism, will be also recycled together
with this GrizzlyFuture object.public void recycle(boolean recycleResult)
GrizzlyFuture
recycle
in interface GrizzlyFuture<R>
recycleResult
- if true - the GrizzlyFuture result,
if it support recyclable mechanism, will be also recycled together
with this GrizzlyFuture object.Copyright © 2014 Oracle Corporation. All rights reserved.