You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/09/09 05:03:26 UTC
[dubbo] branch master updated: optimize generic invoke (#4076)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 69d984e optimize generic invoke (#4076)
69d984e is described below
commit 69d984e90c03e1653248364c6ee984d656c61a8d
Author: min <z8...@gmail.com>
AuthorDate: Mon Sep 9 13:03:21 2019 +0800
optimize generic invoke (#4076)
only effective for hessian2 serialization scenario.
---
dubbo-dependencies-bom/pom.xml | 2 +-
.../src/main/java/org/apache/dubbo/rpc/Constants.java | 2 ++
.../src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java | 5 ++++-
.../main/java/org/apache/dubbo/rpc/support/ProtocolUtils.java | 9 ++++++++-
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml
index 57eb4be..ddd668f 100644
--- a/dubbo-dependencies-bom/pom.xml
+++ b/dubbo-dependencies-bom/pom.xml
@@ -142,7 +142,7 @@
<activation_version>1.2.0</activation_version>
<test_container_version>1.11.2</test_container_version>
<etcd_launcher_version>0.3.0</etcd_launcher_version>
- <hessian_lite_version>3.2.5</hessian_lite_version>
+ <hessian_lite_version>3.2.6</hessian_lite_version>
<swagger_version>1.5.19</swagger_version>
<spring_test_version>4.3.16.RELEASE</spring_test_version>
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java
index f515960..3ea3038 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java
@@ -46,6 +46,8 @@ public interface Constants {
String GENERIC_SERIALIZATION_DEFAULT = "true";
+ String GENERIC_RAW_RETURN = "raw.return";
+
String GENERIC_SERIALIZATION_BEAN = "bean";
String GENERIC_SERIALIZATION_PROTOBUF = "protobuf-json";
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
index ed6e123..226b74e 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
@@ -81,7 +81,8 @@ public class GenericFilter extends ListenableFilter {
}
if (StringUtils.isEmpty(generic)
- || ProtocolUtils.isDefaultGenericSerialization(generic)) {
+ || ProtocolUtils.isDefaultGenericSerialization(generic)
+ || ProtocolUtils.isGenericReturnRawResult(generic)) {
args = PojoUtils.realize(args, params, method.getGenericParameterTypes());
} else if (ProtocolUtils.isJavaGenericSerialization(generic)) {
for (int i = 0; i < args.length; i++) {
@@ -190,6 +191,8 @@ public class GenericFilter extends ListenableFilter {
GENERIC_SERIALIZATION_PROTOBUF +
"] serialize result failed.", e);
}
+ } else if(ProtocolUtils.isGenericReturnRawResult(generic)) {
+ return result;
} else {
appResponse.setValue(PojoUtils.generalize(appResponse.getValue()));
}
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/ProtocolUtils.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/ProtocolUtils.java
index b9a51ca..922ea49 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/ProtocolUtils.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/ProtocolUtils.java
@@ -25,6 +25,7 @@ import static org.apache.dubbo.rpc.Constants.GENERIC_SERIALIZATION_NATIVE_JAVA;
import static org.apache.dubbo.rpc.Constants.GENERIC_SERIALIZATION_DEFAULT;
import static org.apache.dubbo.rpc.Constants.GENERIC_SERIALIZATION_BEAN;
import static org.apache.dubbo.rpc.Constants.GENERIC_SERIALIZATION_PROTOBUF;
+import static org.apache.dubbo.rpc.Constants.GENERIC_RAW_RETURN;
public class ProtocolUtils {
@@ -58,7 +59,9 @@ public class ProtocolUtils {
&& (GENERIC_SERIALIZATION_DEFAULT.equalsIgnoreCase(generic) /* Normal generalization cal */
|| GENERIC_SERIALIZATION_NATIVE_JAVA.equalsIgnoreCase(generic) /* Streaming generalization call supporting jdk serialization */
|| GENERIC_SERIALIZATION_BEAN.equalsIgnoreCase(generic)
- || GENERIC_SERIALIZATION_PROTOBUF.equalsIgnoreCase(generic));
+ || GENERIC_SERIALIZATION_PROTOBUF.equalsIgnoreCase(generic)
+ || GENERIC_RAW_RETURN.equalsIgnoreCase(generic));
+
}
public static boolean isDefaultGenericSerialization(String generic) {
@@ -78,4 +81,8 @@ public class ProtocolUtils {
public static boolean isProtobufGenericSerialization(String generic) {
return isGeneric(generic) && GENERIC_SERIALIZATION_PROTOBUF.equals(generic);
}
+
+ public static boolean isGenericReturnRawResult(String generic) {
+ return GENERIC_RAW_RETURN.equals(generic);
+ }
}