T
- the type parameter for the AsyncCallback
public class RequestCallbackAdapter<T> extends Object implements RequestCallback
RequestCallback
interface to an AsyncCallback
interface.
For internal use only.Modifier and Type | Class and Description |
---|---|
static class |
RequestCallbackAdapter.ResponseReader
Enumeration used to read specific return types out of a
SerializationStreamReader . |
Constructor and Description |
---|
RequestCallbackAdapter(SerializationStreamFactory streamFactory,
String methodName,
RpcStatsContext statsContext,
AsyncCallback<T> callback,
RequestCallbackAdapter.ResponseReader responseReader) |
RequestCallbackAdapter(SerializationStreamFactory streamFactory,
String methodName,
RpcStatsContext statsContext,
AsyncCallback<T> callback,
RpcTokenExceptionHandler tokenExceptionHandler,
RequestCallbackAdapter.ResponseReader responseReader) |
Modifier and Type | Method and Description |
---|---|
void |
onError(Request request,
Throwable exception)
Called when a
Request does not complete
normally. |
void |
onResponseReceived(Request request,
Response response)
Called when a pending
Request completes
normally. |
public RequestCallbackAdapter(SerializationStreamFactory streamFactory, String methodName, RpcStatsContext statsContext, AsyncCallback<T> callback, RequestCallbackAdapter.ResponseReader responseReader)
public RequestCallbackAdapter(SerializationStreamFactory streamFactory, String methodName, RpcStatsContext statsContext, AsyncCallback<T> callback, RpcTokenExceptionHandler tokenExceptionHandler, RequestCallbackAdapter.ResponseReader responseReader)
public void onError(Request request, Throwable exception)
RequestCallback
Request
does not complete
normally. A RequestTimeoutException
is
one example of the type of error that a request may encounter.onError
in interface RequestCallback
request
- the request object which has experienced the error
condition, may be null if the request was never generatedexception
- the error that was encounteredpublic void onResponseReceived(Request request, Response response)
RequestCallback
Request
completes
normally. Note this method is called even when the status code of the
HTTP response is not "OK", 200.onResponseReceived
in interface RequestCallback
request
- the object that generated this eventresponse
- an instance of the
Response
classCopyright © 2018. All rights reserved.