T - The format Requests/Responses are serialized as.public abstract class AbstractHandler<T> extends Object implements Handler<T>
Handlers to extend to inherit functionality common across
serialization strategies.Handler.HandlerResponse<T>| Modifier and Type | Field and Description |
|---|---|
private Service.RpcMetadataResponse |
metadata |
private static String |
NULL_EXCEPTION_MESSAGE |
protected Service |
service |
HTTP_INTERNAL_SERVER_ERROR, HTTP_OK| Constructor and Description |
|---|
AbstractHandler(Service service) |
| Modifier and Type | Method and Description |
|---|---|
Handler.HandlerResponse<T> |
apply(T serializedRequest)
Compute a response for the given request, handling errors generated by that computation.
|
(package private) abstract Service.Request |
decode(T serializedRequest) |
(package private) abstract T |
encode(Service.Response response)
Serialize the given
Service.Response per the concrete Handler implementation. |
private String |
getCausalChain(Exception e)
Constructs a message for the summary of an Exception.
|
void |
setRpcMetadata(Service.RpcMetadataResponse metadata)
Sets some general server information to return to the client in all responses.
|
(package private) Service.ErrorResponse |
unwrapException(Exception e)
Unwrap Avatica-specific context about a given exception.
|
private static final String NULL_EXCEPTION_MESSAGE
protected final Service service
private Service.RpcMetadataResponse metadata
public AbstractHandler(Service service)
abstract Service.Request decode(T serializedRequest) throws IOException
IOExceptionabstract T encode(Service.Response response) throws IOException
Service.Response per the concrete Handler implementation.response - The Service.Response to serialize.Service.Response.IOExceptionService.ErrorResponse unwrapException(Exception e)
e - A caught exception throw by Avatica implementation.Service.ErrorResponse.public Handler.HandlerResponse<T> apply(T serializedRequest)
apply in interface Handler<T>serializedRequest - The caller's request.Service.Response with additional context about that response.private String getCausalChain(Exception e)
e - The Exception to summarize.public void setRpcMetadata(Service.RpcMetadataResponse metadata)
HandlersetRpcMetadata in interface Handler<T>metadata - Server-wide informationCopyright © 2012–2016 The Apache Software Foundation. All rights reserved.