public final class AsyncResponseImpl<T> extends FutureTask<T> implements Response<T>, ResponseContextReceiver
Response
implementation. When Runnbale is executed, it just hands the
request to Fiber and returns. When the Fiber finishes the execution, it sets
response in the FutureTask
Constructor and Description |
---|
AsyncResponseImpl(Runnable runnable,
AsyncHandler<T> handler) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
ResponseContext |
getContext() |
void |
run() |
void |
set(T v,
Throwable t) |
void |
setCancelable(Cancelable cancelable) |
void |
setResponseContext(ResponseContext rc)
Called upon the completion of the invocation
to set a
ResponseContext . |
done, get, get, isCancelled, isDone, runAndReset, set, setException
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, get, isCancelled, isDone
public AsyncResponseImpl(Runnable runnable, @Nullable AsyncHandler<T> handler)
runnable
- This Runnable
is executed asynchronously.handler
- Optional AsyncHandler
to invoke at the end
of the processing. Can be null.public void run()
run
in interface Runnable
run
in interface RunnableFuture<T>
run
in class FutureTask<T>
public ResponseContext getContext()
getContext
in interface Response<T>
public void setResponseContext(ResponseContext rc)
ResponseContextReceiver
ResponseContext
.
This method is invoked even when the invocation fails.
setResponseContext
in interface ResponseContextReceiver
public void setCancelable(Cancelable cancelable)
Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.