Interface EndpointObserver
- All Known Implementing Classes:
AccessController
Coprocessors implement this interface to observe and mediate endpoint invocations on a region.
Exception Handling
For all functions, exception handling is done as follows:- Exceptions of type
IOException
are reported back to client. - For any other kind of exception:
- If the configuration
CoprocessorHost.ABORT_ON_ERROR_KEY
is set to true, then the server aborts. - Otherwise, coprocessor is removed from the server and
DoNotRetryIOException
is returned to the client.
- If the configuration
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
postEndpointInvocation
(ObserverContext<RegionCoprocessorEnvironment> ctx, com.google.protobuf.Service service, String methodName, com.google.protobuf.Message request, com.google.protobuf.Message.Builder responseBuilder) Called after an Endpoint service method is invoked.default com.google.protobuf.Message
preEndpointInvocation
(ObserverContext<RegionCoprocessorEnvironment> ctx, com.google.protobuf.Service service, String methodName, com.google.protobuf.Message request) Called before an Endpoint service method is invoked.
-
Method Details
-
preEndpointInvocation
default com.google.protobuf.Message preEndpointInvocation(ObserverContext<RegionCoprocessorEnvironment> ctx, com.google.protobuf.Service service, String methodName, com.google.protobuf.Message request) throws IOException Called before an Endpoint service method is invoked. The request message can be altered by returning a new instance. Throwing an exception will abort the invocation. CallingObserverContext.bypass()
has no effect in this hook.- Parameters:
ctx
- the environment provided by the region serverservice
- the endpoint servicerequest
- Request message expected by givenService
's method (by the namemethodName
).methodName
- the invoked service method- Returns:
- the possibly modified message
- Throws:
IOException
-
postEndpointInvocation
default void postEndpointInvocation(ObserverContext<RegionCoprocessorEnvironment> ctx, com.google.protobuf.Service service, String methodName, com.google.protobuf.Message request, com.google.protobuf.Message.Builder responseBuilder) throws IOException Called after an Endpoint service method is invoked. The response message can be altered using the builder.- Parameters:
ctx
- the environment provided by the region serverservice
- the endpoint servicemethodName
- the invoked service methodrequest
- Request message expected by givenService
's method (by the namemethodName
).responseBuilder
- Builder for final response to the client, with original response from Service's method merged into it.- Throws:
IOException
-