Class ProtobufHandler
- java.lang.Object
-
- org.apache.calcite.avatica.remote.AbstractHandler<byte[]>
-
- org.apache.calcite.avatica.remote.ProtobufHandler
-
- All Implemented Interfaces:
Handler<byte[]>
public class ProtobufHandler extends AbstractHandler<byte[]>
Dispatches serialized protocol buffer messages to the providedServiceby converting them to the POJO Request. Returns back the serialized protocol buffer response.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.avatica.remote.Handler
Handler.HandlerResponse<T>
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.calcite.avatica.metrics.MetricsSystemmetricsprivate org.apache.calcite.avatica.metrics.TimerserializationTimerprivate ProtobufTranslationtranslation-
Fields inherited from class org.apache.calcite.avatica.remote.AbstractHandler
service
-
Fields inherited from interface org.apache.calcite.avatica.remote.Handler
HANDLER_SERIALIZATION_METRICS_NAME, HTTP_INTERNAL_SERVER_ERROR, HTTP_OK, HTTP_UNAUTHENTICATED, HTTP_UNAUTHORIZED
-
-
Constructor Summary
Constructors Constructor Description ProtobufHandler(Service service, ProtobufTranslation translation, org.apache.calcite.avatica.metrics.MetricsSystem metrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Handler.HandlerResponse<byte[]>apply(byte[] requestBytes)Compute a response for the given request, handling errors generated by that computation.(package private) Service.Requestdecode(byte[] serializedRequest)(package private) byte[]encode(Service.Response response)Serialize the givenService.Responseper the concreteHandlerimplementation.-
Methods inherited from class org.apache.calcite.avatica.remote.AbstractHandler
convertToErrorResponse, setRpcMetadata, unauthenticatedErrorResponse, unauthorizedErrorResponse, unwrapException
-
-
-
-
Field Detail
-
translation
private final ProtobufTranslation translation
-
metrics
private final org.apache.calcite.avatica.metrics.MetricsSystem metrics
-
serializationTimer
private final org.apache.calcite.avatica.metrics.Timer serializationTimer
-
-
Constructor Detail
-
ProtobufHandler
public ProtobufHandler(Service service, ProtobufTranslation translation, org.apache.calcite.avatica.metrics.MetricsSystem metrics)
-
-
Method Detail
-
apply
public Handler.HandlerResponse<byte[]> apply(byte[] requestBytes)
Description copied from class:AbstractHandlerCompute a response for the given request, handling errors generated by that computation.- Specified by:
applyin interfaceHandler<byte[]>- Overrides:
applyin classAbstractHandler<byte[]>- Parameters:
requestBytes- The caller's request.- Returns:
- A
Service.Responsewith additional context about that response.
-
decode
Service.Request decode(byte[] serializedRequest) throws java.io.IOException
- Specified by:
decodein classAbstractHandler<byte[]>- Throws:
java.io.IOException
-
encode
byte[] encode(Service.Response response) throws java.io.IOException
Description copied from class:AbstractHandlerSerialize the givenService.Responseper the concreteHandlerimplementation.- Specified by:
encodein classAbstractHandler<byte[]>- Parameters:
response- TheService.Responseto serialize.- Returns:
- A serialized representation of the
Service.Response. - Throws:
java.io.IOException
-
-