/** * Handle an incoming CorfuMsg. * * @param message The message to handle. * @param ctx The channel handler context. * @return True, if the message was handled. False otherwise. */ @SuppressWarnings("unchecked") public boolean handle(CorfuMsg message, ChannelHandlerContext ctx) { if (handlerMap.containsKey(message.getMsgType())) { try { Object ret = handlerMap.get(message.getMsgType()) .handle(message, ctx, client.getRouter()); if (ret != null) { client.getRouter().completeRequest(message.getRequestID(), ret); } } catch (Exception ex) { client.getRouter().completeExceptionally(message.getRequestID(), ex); } return true; } return false; }