@Override public void sendResponse(String message) { // restore Logging context on callback. try (MDCCloseable mdc = Logging.withContextMapCloseable(loggingContext)) { // When message is not null, it's called from kafka consumer otherwise it is from timeout tracker. if (message != null) { T response = rpcModule.unmarshalResponse(message); if (response.getErrorMessage() != null) { responseFuture.completeExceptionally(new RemoteExecutionException(response.getErrorMessage())); } else { responseFuture.complete(response); } isProcessed = true; } else { responseFuture.completeExceptionally(new RequestTimedOutException(new TimeoutException())); } rpcResponseMap.remove(rpcId); messageCache.remove(rpcId); } catch (Exception e) { LOG.warn("error while handling response for RPC request id {}", rpcId, e); } }
@Override public void sendResponse(String message) { // restore Logging context on callback. try (MDCCloseable mdc = Logging.withContextMapCloseable(loggingContext)) { // When message is not null, it's called from kafka consumer otherwise it is from timeout tracker. if (message != null) { T response = rpcModule.unmarshalResponse(message); if (response.getErrorMessage() != null) { responseFuture.completeExceptionally(new RemoteExecutionException(response.getErrorMessage())); } else { responseFuture.complete(response); } isProcessed = true; } else { responseFuture.completeExceptionally(new RequestTimedOutException(new TimeoutException())); } rpcResponseMap.remove(rpcId); messageCache.remove(rpcId); } catch (Exception e) { LOG.warn("error while handling response for RPC request id {}", rpcId, e); } }