@Override public void onError(Throwable throwable) { finishLatch.countDown(); this.throwable = errorUtils.toGrpcRuntimeException(throwable); this.LOGGER.info("{} source streaming error: {}", this.classSimpleName, errorUtils.getStackTrace(this.throwable)); }
public void errorCallerStreamingRpc(Throwable t) { requestObserver.onError(errorUtils.toGrpcRuntimeException(t)); }
@Override public void onError(Throwable throwable) { Exception e = errorUtils.toGrpcRuntimeException(throwable); delayedResult.setError(e); delayedResult.getLatch().countDown(); LOGGER.error(errorUtils.getStackTrace(e)); }
@Override public void onError(Throwable throwable) { this.throwable = errorUtils.toGrpcRuntimeException(throwable); for (StreamObserver streamObserver : errorListeners) { if (streamObserver != null) { streamObserver.onError(throwable); } } callerNotifier.onError(this.throwable); LOGGER.debug("{} dest streaming error: {}", this.classSimpleName, errorUtils.getStackTrace(throwable)); }
public void wrapGrpcServerRunnable(StreamObserver responseObserver, GrpcServerRunnable target) { try { target.run(); } catch (Throwable t) { LOGGER.error(errorUtils.getStackTrace(t)); responseObserver.onError(errorUtils.toGrpcRuntimeException(t)); } }
public <T> T wrapGrpcServerCallable(StreamObserver responseObserver, GrpcServerCallable<T> target) { T result = null; try { result = target.run(); } catch (Throwable t) { LOGGER.error(errorUtils.getStackTrace(t)); responseObserver.onError(errorUtils.toGrpcRuntimeException(t)); } return result; } }
public void completeStreamingRpc() { streamProcessor.complete(); if (!(streamProcessor instanceof BaseStreamProcessor)) { try { requestObserver.onCompleted(); } catch (IllegalStateException e) { LOGGER.error(errorUtils.toGrpcRuntimeException(e)); } } grpcAsyncClientContext.awaitFinish(finishLatch, grpcAsyncClientContext.getFinishTimeout(), grpcAsyncClientContext.getFinishTimeoutUnit(), grpcAsyncClientContext.getExceptionHandler()); }
public <T> void processCrudRequestInternal(BasicMeta.CallRequest request, StreamObserver response, CrudServerProcessor<T> crudServerProcessor) { BasicMeta.CallResponse result = null; try { paramValidationHelper.validate(request); BasicMeta.Data requestData = request.getParam(); Object record = byteStringSerDesHelper.deserialize(requestData.getData(), Class.forName(requestData.getType())); T callResult = (T) crudServerProcessor.process(record); if (crudServerProcessor.isValid(callResult)) { result = callMetaModelFactory.createNormalCallResponse(crudServerProcessor.pickResult(record, callResult)); } else { result = callMetaModelFactory.createErrorCallResponse( 102, "Failed to perform" + recordClass.getSimpleName() + " crud operation in database", record); } response.onNext(result); response.onCompleted(); } catch (Exception e) { response.onError(errorUtils.toGrpcRuntimeException(e)); } }