Skip to content

Commit b678dda

Browse files
committed
don't applyCustomizeException in not grpc node
1 parent 64acfeb commit b678dda

File tree

5 files changed

+33
-21
lines changed

5 files changed

+33
-21
lines changed

dubbo-rpc/dubbo-rpc-triple/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@
196196
<plugin>
197197
<groupId>org.codehaus.gmavenplus</groupId>
198198
<artifactId>gmavenplus-plugin</artifactId>
199+
<executions>
200+
<execution>
201+
<goals>
202+
<goal>compileTests</goal>
203+
</goals>
204+
</execution>
205+
</executions>
199206
</plugin>
200207
</plugins>
201208
</build>

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/UnaryServerCallListener.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424

2525
public class UnaryServerCallListener extends AbstractServerCallListener {
2626

27-
private boolean applyCustomizeException = false;
27+
private final boolean applyCustomizeException;
2828

2929
public UnaryServerCallListener(
30-
RpcInvocation invocation, Invoker<?> invoker, StreamObserver<Object> responseObserver) {
30+
RpcInvocation invocation,
31+
Invoker<?> invoker,
32+
StreamObserver<Object> responseObserver,
33+
boolean applyCustomizeException) {
3134
super(invocation, invoker, responseObserver);
32-
}
33-
34-
public void setApplyCustomizeException(boolean applyCustomizeException) {
3535
this.applyCustomizeException = applyCustomizeException;
3636
}
3737

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/grpc/GrpcHttp2ServerTransportListener.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.apache.dubbo.rpc.TriRpcStatus;
3535
import org.apache.dubbo.rpc.model.FrameworkModel;
3636
import org.apache.dubbo.rpc.protocol.tri.DescriptorUtils;
37+
import org.apache.dubbo.rpc.protocol.tri.ReflectionPackableMethod;
3738
import org.apache.dubbo.rpc.protocol.tri.RpcInvocationBuildContext;
3839
import org.apache.dubbo.rpc.protocol.tri.compressor.DeCompressor;
3940
import org.apache.dubbo.rpc.protocol.tri.compressor.Identity;
@@ -138,6 +139,19 @@ protected GrpcStreamingDecoder getStreamingDecoder() {
138139
return (GrpcStreamingDecoder) super.getStreamingDecoder();
139140
}
140141

142+
@Override
143+
protected boolean applyCustomizeException() {
144+
RpcInvocationBuildContext context = getContext();
145+
if (context.isHasStub()) {
146+
return false;
147+
}
148+
MethodMetadata methodMetadata = context.getMethodMetadata();
149+
return ReflectionPackableMethod.needWrap(
150+
context.getMethodDescriptor(),
151+
methodMetadata.getActualRequestTypes(),
152+
methodMetadata.getActualResponseType());
153+
}
154+
141155
private class LazyFindMethodListener implements HttpMessageListener {
142156

143157
private final StreamingDecoder streamingDecoder;

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http1/DefaultHttp11ServerTransportListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static class AutoCompleteUnaryServerCallListener extends UnaryServerCall
126126

127127
public AutoCompleteUnaryServerCallListener(
128128
RpcInvocation invocation, Invoker<?> invoker, StreamObserver<Object> responseObserver) {
129-
super(invocation, invoker, responseObserver);
129+
super(invocation, invoker, responseObserver, false);
130130
}
131131

132132
@Override

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http2/GenericHttp2ServerTransportListener.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.apache.dubbo.remoting.http12.message.DefaultListeningDecoder;
3030
import org.apache.dubbo.remoting.http12.message.DefaultStreamingDecoder;
3131
import org.apache.dubbo.remoting.http12.message.ListeningDecoder;
32-
import org.apache.dubbo.remoting.http12.message.MethodMetadata;
3332
import org.apache.dubbo.remoting.http12.message.StreamingDecoder;
3433
import org.apache.dubbo.remoting.http12.message.codec.JsonCodec;
3534
import org.apache.dubbo.rpc.CancellationContext;
@@ -39,7 +38,6 @@
3938
import org.apache.dubbo.rpc.executor.ExecutorSupport;
4039
import org.apache.dubbo.rpc.model.FrameworkModel;
4140
import org.apache.dubbo.rpc.model.MethodDescriptor;
42-
import org.apache.dubbo.rpc.protocol.tri.ReflectionPackableMethod;
4341
import org.apache.dubbo.rpc.protocol.tri.RpcInvocationBuildContext;
4442
import org.apache.dubbo.rpc.protocol.tri.TripleProtocol;
4543
import org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener;
@@ -109,19 +107,8 @@ private ServerCallListener startListener(
109107
switch (methodDescriptor.getRpcType()) {
110108
case UNARY:
111109
onUnary();
112-
boolean applyCustomizeException = false;
113-
if (!getContext().isHasStub()) {
114-
MethodMetadata methodMetadata = getContext().getMethodMetadata();
115-
applyCustomizeException = ReflectionPackableMethod.needWrap(
116-
methodDescriptor,
117-
methodMetadata.getActualRequestTypes(),
118-
methodMetadata.getActualResponseType());
119-
}
120110
onListenerStart();
121-
UnaryServerCallListener unaryServerCallListener =
122-
startUnary(invocation, invoker, getServerChannelObserver());
123-
unaryServerCallListener.setApplyCustomizeException(applyCustomizeException);
124-
return unaryServerCallListener;
111+
return startUnary(invocation, invoker, getServerChannelObserver());
125112
case SERVER_STREAM:
126113
onListenerStart();
127114
return startServerStreaming(invocation, invoker, getServerChannelObserver());
@@ -147,7 +134,7 @@ protected void onListenerStart() {
147134

148135
private UnaryServerCallListener startUnary(
149136
RpcInvocation invocation, Invoker<?> invoker, Http2ServerChannelObserver responseObserver) {
150-
return new UnaryServerCallListener(invocation, invoker, responseObserver);
137+
return new UnaryServerCallListener(invocation, invoker, responseObserver, applyCustomizeException());
151138
}
152139

153140
private ServerStreamServerCallListener startServerStreaming(
@@ -216,6 +203,10 @@ protected final Http2ServerChannelObserver getServerChannelObserver() {
216203
return serverChannelObserver;
217204
}
218205

206+
protected boolean applyCustomizeException() {
207+
return false;
208+
}
209+
219210
@Override
220211
public void close() throws Exception {
221212
getServerChannelObserver().close();

0 commit comments

Comments
 (0)