Search in sources :

Example 1 with SerializationException

use of io.atomix.catalyst.serializer.SerializationException in project alluxio by Alluxio.

the class GrpcMessagingConnection method handleRequestMessage.

/**
 * Handles request message received from target.
 *
 * @param requestMessage the request message
 */
private void handleRequestMessage(TransportMessage requestMessage) {
    // Get request Id.
    long requestId = requestMessage.getRequestHeader().getRequestId();
    try {
        // Deserialize request object.
        Object request = mContext.serializer().readObject(requestMessage.getMessage().newInput());
        LOG.debug("Handling request({}) of type: {}. GrpcMessagingConnection: {}", requestId, request.getClass().getName(), mConnectionId);
        // Find handler for the request.
        GrpcMessagingConnection.HandlerHolder handler = mHandlers.get(request.getClass());
        if (handler != null) {
            // Handle the request.
            handler.getContext().executor().execute(() -> handleRequest(requestId, request, handler));
        } else {
            // Send fail response.
            sendResponse(requestId, mContext, new SerializationException("Unknown message type: " + request.getClass()));
        }
    } catch (SerializationException e) {
        // Send fail response.
        sendResponse(requestId, mContext, e);
    }
}
Also used : SerializationException(io.atomix.catalyst.serializer.SerializationException)

Aggregations

SerializationException (io.atomix.catalyst.serializer.SerializationException)1