Java Code Examples for io.netty.util.internal.ThrowableUtil#stackTraceToString()
The following examples show how to use
io.netty.util.internal.ThrowableUtil#stackTraceToString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerInvocation.java From saluki with Apache License 2.0 | 6 votes |
@Override public StreamObserver<Message> invoke(StreamObserver<Message> responseObserver) { try { this.remote = RpcContext.getContext().getAttachment(Constants.REMOTE_ADDRESS); Class<?> requestType = grpcMethodType.requestType(); PoJo2ProtoStreamObserver servserResponseObserver = PoJo2ProtoStreamObserver.newObserverWrap(responseObserver); Object result = method.invoke(serviceToInvoke, servserResponseObserver); return Proto2PoJoStreamObserver.newObserverWrap((StreamObserver<Object>) result, requestType); } catch (Throwable e) { String stackTrace = ThrowableUtil.stackTraceToString(e); log.error(e.getMessage(), e); StatusRuntimeException statusException = Status.UNAVAILABLE.withDescription(stackTrace).asRuntimeException(); responseObserver.onError(statusException); } finally { log.debug(String.format("Service: %s Method: %s RemoteAddress: %s", providerUrl.getServiceInterface(), method.getName(), this.remote)); } return null; }
Example 2
Source File: ServerInvocation.java From saluki with Apache License 2.0 | 6 votes |
private void streamCall(Message request, StreamObserver<Message> responseObserver) { try { Class<?> requestType = grpcMethodType.requestType(); Object reqPojo = SerializerUtil.protobuf2Pojo(request, requestType); Object[] requestParams = new Object[] {reqPojo, PoJo2ProtoStreamObserver.newObserverWrap(responseObserver)}; method.invoke(serviceToInvoke, requestParams); } catch (Throwable e) { String stackTrace = ThrowableUtil.stackTraceToString(e); log.error(e.getMessage(), e); StatusRuntimeException statusException = Status.UNAVAILABLE.withDescription(stackTrace).asRuntimeException(); responseObserver.onError(statusException); } finally { log.debug(String.format("Service: %s Method: %s RemoteAddress: %s", providerUrl.getServiceInterface(), method.getName(), this.remote)); } }
Example 3
Source File: PoJo2ProtoStreamObserver.java From saluki with Apache License 2.0 | 5 votes |
@Override public void onNext(Object value) { try { Object respPojo = value; Message respProtoBufer = SerializerUtil.pojo2Protobuf(respPojo); streamObserver.onNext(respProtoBufer); } catch (ProtobufException e) { String stackTrace = ThrowableUtil.stackTraceToString(e); StatusRuntimeException statusException = Status.UNAVAILABLE.withDescription(stackTrace).asRuntimeException(); streamObserver.onError(statusException); } }
Example 4
Source File: Proto2PoJoStreamObserver.java From saluki with Apache License 2.0 | 5 votes |
@Override public void onNext(Message value) { try { Object respPoJo = SerializerUtil.protobuf2Pojo(value, poJoType); streamObserver.onNext(respPoJo); } catch (ProtobufException e) { String stackTrace = ThrowableUtil.stackTraceToString(e); StatusRuntimeException statusException = Status.UNAVAILABLE.withDescription(stackTrace).asRuntimeException(); streamObserver.onError(statusException); } }