@Override public void sendResponse(Operation operation, Object obj) { Address target = operation.getCallerAddress(); boolean send; if (obj == null) { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), null); } else if (obj.getClass() == NormalResponse.class) { NormalResponse response = (NormalResponse) obj; send = sendNormalResponse( target, response.getCallId(), response.getBackupAcks(), response.isUrgent(), response.getValue()); } else if (obj.getClass() == ErrorResponse.class || obj.getClass() == CallTimeoutResponse.class) { send = send(target, (Response) obj); } else if (obj instanceof Throwable) { send = send(target, new ErrorResponse((Throwable) obj, operation.getCallId(), operation.isUrgent())); } else { // most regular responses not wrapped in a NormalResponse. So we are now completely skipping the // NormalResponse instance send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), obj); } if (!send) { logger.warning("Cannot send response: " + obj + " to " + target + ". " + operation); } }
outboundResponseHandler.send(caller, new ErrorResponse(throwable, callId, packet.isUrgent())); logOperationDeserializationException(throwable, callId); throw ExceptionUtil.rethrow(throwable);
@Override public void sendResponse(Operation operation, Object obj) { Address target = operation.getCallerAddress(); boolean send; if (obj == null) { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), null); } else if (obj.getClass() == NormalResponse.class) { NormalResponse response = (NormalResponse) obj; send = sendNormalResponse( target, response.getCallId(), response.getBackupAcks(), response.isUrgent(), response.getValue()); } else if (obj.getClass() == ErrorResponse.class || obj.getClass() == CallTimeoutResponse.class) { send = send(target, (Response) obj); } else if (obj instanceof Throwable) { send = send(target, new ErrorResponse((Throwable) obj, operation.getCallId(), operation.isUrgent())); } else { // most regular responses not wrapped in a NormalResponse. So we are now completely skipping the // NormalResponse instance send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), obj); } if (!send) { logger.warning("Cannot send response: " + obj + " to " + target + ". " + operation); } }
outboundResponseHandler.send(caller, new ErrorResponse(throwable, callId, packet.isUrgent())); logOperationDeserializationException(throwable, callId); throw ExceptionUtil.rethrow(throwable);