try{
MessageLite m = getResponseDefaultInstance(msg.rpcType);
assert rpcConfig.checkReceive(msg.rpcType, m.getClass());
RpcOutcome<?> rpcFuture = queue.getFuture(msg.rpcType, msg.coordinationId, m.getClass());
Parser<?> parser = m.getParserForType();
Object value = parser.parseFrom(new ByteBufInputStream(msg.pBody, msg.pBody.readableBytes()));
rpcFuture.set(value, msg.dBody);
msg.release(); // we release our ownership. Handle could have taken over ownership.
if (RpcConstants.EXTRA_DEBUGGING) logger.debug("Updated rpc future {} with value {}", rpcFuture, value);
}catch(Exception ex){
logger.error("Failure while handling response.", ex);
throw ex;
}
break;
case RESPONSE_FAILURE:
RpcFailure failure = RpcFailure.parseFrom(new ByteBufInputStream(msg.pBody, msg.pBody.readableBytes()));
queue.updateFailedFuture(msg.coordinationId, failure);
if (RpcConstants.EXTRA_DEBUGGING)
logger.debug("Updated rpc future with coordinationId {} with failure ", msg.coordinationId, failure);
break;