mytang0 commented on code in PR #11770:
URL: https://github.com/apache/dubbo/pull/11770#discussion_r1135174149
##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/BiStreamServerCallListener.java:
##########
@@ -27,24 +27,32 @@ public class BiStreamServerCallListener extends
AbstractServerCallListener {
private StreamObserver<Object> requestObserver;
- public BiStreamServerCallListener(RpcInvocation invocation, Invoker<?>
invoker,
- ServerCallToObserverAdapter<Object> responseObserver) {
+ public BiStreamServerCallListener(RpcInvocation invocation,
+ Invoker<?> invoker,
+ ServerCallToObserverAdapter<Object>
responseObserver) {
super(invocation, invoker, responseObserver);
invocation.setArguments(new Object[]{responseObserver});
invoke();
}
@Override
+ @SuppressWarnings("unchecked")
public void onReturn(Object value) {
- this.requestObserver = (StreamObserver<Object>) value;
+ if (value instanceof Throwable) {
+ responseObserver.onError((Throwable) value);
+ } else if (value instanceof StreamObserver) {
+ this.requestObserver = (StreamObserver<Object>) value;
+ }
}
@Override
public void onMessage(Object message) {
if (message instanceof Object[]) {
message = ((Object[]) message)[0];
}
- requestObserver.onNext(message);
+ if (requestObserver != null) {
Review Comment:
Yes, just bounds checked.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]