You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ca...@apache.org on 2019/04/19 03:47:28 UTC

[incubator-dubbo] branch 3.x-dev updated: Rename some variables to avoid possible confusion between Result and AppResponse. (#3889)

This is an automated email from the ASF dual-hosted git repository.

carryxyh pushed a commit to branch 3.x-dev
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/3.x-dev by this push:
     new 13c1571  Rename some variables to avoid possible confusion between Result and AppResponse. (#3889)
13c1571 is described below

commit 13c157176a46d239db00303b3bb657dc686d03b4
Author: ken.lj <ke...@gmail.com>
AuthorDate: Fri Apr 19 11:47:20 2019 +0800

    Rename some variables to avoid possible confusion between Result and AppResponse. (#3889)
    
    Clear that the `Result` of the call back is actually an `AppResponse`.
---
 .../cluster/support/FailsafeClusterInvoker.java    |  2 +-
 .../java/org/apache/dubbo/remoting/MockResult.java |  2 +-
 .../java/org/apache/dubbo/rpc/AsyncRpcResult.java  | 26 +++++++++++-----------
 .../src/main/java/org/apache/dubbo/rpc/Filter.java |  2 +-
 .../apache/dubbo/rpc/filter/ActiveLimitFilter.java |  2 +-
 .../apache/dubbo/rpc/filter/CompatibleFilter.java  |  8 +++----
 .../dubbo/rpc/filter/ConsumerContextFilter.java    |  4 ++--
 .../org/apache/dubbo/rpc/filter/ContextFilter.java |  4 ++--
 .../apache/dubbo/rpc/filter/ExceptionFilter.java   |  8 +++----
 .../dubbo/rpc/filter/ExecuteLimitFilter.java       |  2 +-
 .../org/apache/dubbo/rpc/filter/GenericFilter.java | 14 ++++++------
 .../apache/dubbo/rpc/filter/GenericImplFilter.java | 18 +++++++--------
 .../org/apache/dubbo/rpc/filter/TimeoutFilter.java |  2 +-
 .../java/org/apache/dubbo/rpc/RpcResultTest.java   |  8 +++----
 .../rpc/filter/CompatibleFilterFilterTest.java     | 12 +++++-----
 .../dubbo/rpc/filter/ExceptionFilterTest.java      | 25 ++++++++++-----------
 .../apache/dubbo/rpc/filter/GenericFilterTest.java |  8 +++----
 .../dubbo/rpc/protocol/thrift/ThriftCodec.java     |  8 +++----
 .../dubbo/rpc/protocol/thrift/ThriftCodecTest.java | 14 ++++++------
 19 files changed, 84 insertions(+), 85 deletions(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java
index 061068a..539686e 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java
@@ -29,7 +29,7 @@ import org.apache.dubbo.rpc.cluster.LoadBalance;
 import java.util.List;
 
 /**
- * When invoke fails, log the error message and ignore this error by returning an empty RpcResult.
+ * When invoke fails, log the error message and ignore this error by returning an empty Result.
  * Usually used to write audit logs and other operations
  *
  * <a href="http://en.wikipedia.org/wiki/Fail-safe">Fail-safe</a>
diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/MockResult.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/MockResult.java
index 7836952..c353621 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/MockResult.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/MockResult.java
@@ -19,7 +19,7 @@ package org.apache.dubbo.remoting;
 import java.io.Serializable;
 
 /**
- * RpcResult.
+ * AppResponse.
  */
 
 public class MockResult implements Serializable {
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java
index e48b713..789cbe7 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java
@@ -47,7 +47,7 @@ public class AsyncRpcResult implements Result {
 
     @Override
     public Object getValue() {
-        return getRpcResult().getValue();
+        return getAppResponse().getValue();
     }
 
     @Override
@@ -57,7 +57,7 @@ public class AsyncRpcResult implements Result {
 
     @Override
     public Throwable getException() {
-        return getRpcResult().getException();
+        return getAppResponse().getException();
     }
 
     @Override
@@ -67,7 +67,7 @@ public class AsyncRpcResult implements Result {
 
     @Override
     public boolean hasException() {
-        return getRpcResult().hasException();
+        return getAppResponse().hasException();
     }
 
     public CompletableFuture<AppResponse> getResponseFuture() {
@@ -78,7 +78,7 @@ public class AsyncRpcResult implements Result {
         this.responseFuture = responseFuture;
     }
 
-    public Result getRpcResult() {
+    public Result getAppResponse() {
         try {
             if (responseFuture.isDone()) {
                 return responseFuture.get();
@@ -94,9 +94,9 @@ public class AsyncRpcResult implements Result {
     public Object recreate() throws Throwable {
         RpcInvocation rpcInvocation = (RpcInvocation) invocation;
         if (InvokeMode.FUTURE == rpcInvocation.getInvokeMode()) {
-            AppResponse rpcResult = new AppResponse();
+            AppResponse appResponse = new AppResponse();
             CompletableFuture<Object> future = new CompletableFuture<>();
-            rpcResult.setValue(future);
+            appResponse.setValue(future);
             responseFuture.whenComplete((result, t) -> {
                 if (t != null) {
                     if (t instanceof CompletionException) {
@@ -111,7 +111,7 @@ public class AsyncRpcResult implements Result {
                     }
                 }
             });
-            return rpcResult.recreate();
+            return appResponse.recreate();
         } else if (responseFuture.isDone()) {
             return responseFuture.get().recreate();
         }
@@ -135,32 +135,32 @@ public class AsyncRpcResult implements Result {
 
     @Override
     public Map<String, String> getAttachments() {
-        return getRpcResult().getAttachments();
+        return getAppResponse().getAttachments();
     }
 
     @Override
     public void setAttachments(Map<String, String> map) {
-        getRpcResult().setAttachments(map);
+        getAppResponse().setAttachments(map);
     }
 
     @Override
     public void addAttachments(Map<String, String> map) {
-        getRpcResult().addAttachments(map);
+        getAppResponse().addAttachments(map);
     }
 
     @Override
     public String getAttachment(String key) {
-        return getRpcResult().getAttachment(key);
+        return getAppResponse().getAttachment(key);
     }
 
     @Override
     public String getAttachment(String key, String defaultValue) {
-        return getRpcResult().getAttachment(key, defaultValue);
+        return getAppResponse().getAttachment(key, defaultValue);
     }
 
     @Override
     public void setAttachment(String key, String value) {
-        getRpcResult().setAttachment(key, value);
+        getAppResponse().setAttachment(key, value);
     }
 
     /**
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Filter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Filter.java
index 7c63448..3445488 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Filter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Filter.java
@@ -49,7 +49,7 @@ public interface Filter {
 
     interface Listener {
 
-        void onResponse(Result result, Invoker<?> invoker, Invocation invocation);
+        void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation);
 
         void onError(Throwable t, Invoker<?> invoker, Invocation invocation);
     }
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java
index fe692af..1fd0a8b 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ActiveLimitFilter.java
@@ -83,7 +83,7 @@ public class ActiveLimitFilter extends ListenableFilter {
 
     static class ActiveLimitListener implements Listener {
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
             String methodName = invocation.getMethodName();
             URL url = invoker.getUrl();
             int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0);
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/CompatibleFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/CompatibleFilter.java
index ad1a8a2..2eb67b4 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/CompatibleFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/CompatibleFilter.java
@@ -60,9 +60,9 @@ public class CompatibleFilter extends ListenableFilter {
 
     static class CompatibleListener implements Listener {
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
-            if (!invocation.getMethodName().startsWith("$") && !result.hasException()) {
-                Object value = result.getValue();
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
+            if (!invocation.getMethodName().startsWith("$") && !appResponse.hasException()) {
+                Object value = appResponse.getValue();
                 if (value != null) {
                     try {
                         Method method = invoker.getInterface().getMethod(invocation.getMethodName(), invocation.getParameterTypes());
@@ -81,7 +81,7 @@ public class CompatibleFilter extends ListenableFilter {
                             newValue = value;
                         }
                         if (newValue != value) {
-                            result.setValue(newValue);
+                            appResponse.setValue(newValue);
                         }
                     } catch (Throwable t) {
                         logger.warn(t.getMessage(), t);
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ConsumerContextFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ConsumerContextFilter.java
index a2005e2..794b6fd 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ConsumerContextFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ConsumerContextFilter.java
@@ -62,8 +62,8 @@ public class ConsumerContextFilter extends ListenableFilter {
 
     static class ConsumerContextListener implements Listener {
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
-            RpcContext.getServerContext().setAttachments(result.getAttachments());
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
+            RpcContext.getServerContext().setAttachments(appResponse.getAttachments());
         }
 
         @Override
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java
index f053438..e47d5b0 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java
@@ -90,9 +90,9 @@ public class ContextFilter extends ListenableFilter {
 
     static class ContextListener implements Listener {
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
             // pass attachments to result
-            result.addAttachments(RpcContext.getServerContext().getAttachments());
+            appResponse.addAttachments(RpcContext.getServerContext().getAttachments());
         }
 
         @Override
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExceptionFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExceptionFilter.java
index 1cb9f87..4fcf540 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExceptionFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExceptionFilter.java
@@ -60,10 +60,10 @@ public class ExceptionFilter extends ListenableFilter {
         private Logger logger = LoggerFactory.getLogger(ExceptionListener.class);
 
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
-            if (result.hasException() && GenericService.class != invoker.getInterface()) {
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
+            if (appResponse.hasException() && GenericService.class != invoker.getInterface()) {
                 try {
-                    Throwable exception = result.getException();
+                    Throwable exception = appResponse.getException();
 
                     // directly throw if it's checked exception
                     if (!(exception instanceof RuntimeException) && (exception instanceof Exception)) {
@@ -102,7 +102,7 @@ public class ExceptionFilter extends ListenableFilter {
                     }
 
                     // otherwise, wrap with RuntimeException and throw back to the client
-                    result.setException(new RuntimeException(StringUtils.toString(exception)));
+                    appResponse.setException(new RuntimeException(StringUtils.toString(exception)));
                     return;
                 } catch (Throwable e) {
                     logger.warn("Fail to ExceptionFilter when called by " + RpcContext.getContext().getRemoteHost() + ". service: " + invoker.getInterface().getName() + ", method: " + invocation.getMethodName() + ", exception: " + e.getClass().getName() + ": " + e.getMessage(), e);
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java
index c1b2eb5..8456a36 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java
@@ -68,7 +68,7 @@ public class ExecuteLimitFilter extends ListenableFilter {
 
     static class ExecuteLimitListener implements Listener {
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
             RpcStatus.endCount(invoker.getUrl(), invocation.getMethodName(), getElapsed(invocation), true);
         }
 
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 5c86cae..190f8a1 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
@@ -124,7 +124,7 @@ public class GenericFilter extends ListenableFilter {
     static class GenericListener implements Listener {
 
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation inv) {
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation inv) {
             if ((inv.getMethodName().equals(Constants.$INVOKE) || inv.getMethodName().equals(Constants.$INVOKE_ASYNC))
                     && inv.getArguments() != null
                     && inv.getArguments().length == 3
@@ -135,21 +135,21 @@ public class GenericFilter extends ListenableFilter {
                     generic = RpcContext.getContext().getAttachment(Constants.GENERIC_KEY);
                 }
 
-                if (result.hasException() && !(result.getException() instanceof GenericException)) {
-                    result.setException(new GenericException(result.getException()));
+                if (appResponse.hasException() && !(appResponse.getException() instanceof GenericException)) {
+                    appResponse.setException(new GenericException(appResponse.getException()));
                 }
                 if (ProtocolUtils.isJavaGenericSerialization(generic)) {
                     try {
                         UnsafeByteArrayOutputStream os = new UnsafeByteArrayOutputStream(512);
-                        ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA).serialize(null, os).writeObject(result.getValue());
-                        result.setValue(os.toByteArray());
+                        ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA).serialize(null, os).writeObject(appResponse.getValue());
+                        appResponse.setValue(os.toByteArray());
                     } catch (IOException e) {
                         throw new RpcException("Serialize result failed.", e);
                     }
                 } else if (ProtocolUtils.isBeanGenericSerialization(generic)) {
-                    result.setValue(JavaBeanSerializeUtil.serialize(result.getValue(), JavaBeanAccessor.METHOD));
+                    appResponse.setValue(JavaBeanSerializeUtil.serialize(appResponse.getValue(), JavaBeanAccessor.METHOD));
                 } else {
-                    result.setValue(PojoUtils.generalize(result.getValue()));
+                    appResponse.setValue(PojoUtils.generalize(appResponse.getValue()));
                 }
             }
         }
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericImplFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericImplFilter.java
index f9caf44..d6981e9 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericImplFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericImplFilter.java
@@ -121,34 +121,34 @@ public class GenericImplFilter extends ListenableFilter {
 
     static class GenericImplListener implements Listener {
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
             String generic = invoker.getUrl().getParameter(Constants.GENERIC_KEY);
             String methodName = invocation.getMethodName();
             Class<?>[] parameterTypes = invocation.getParameterTypes();
             if (ProtocolUtils.isGeneric(generic)
                     && (!Constants.$INVOKE.equals(invocation.getMethodName()) && !Constants.$INVOKE_ASYNC.equals(invocation.getMethodName()))
                     && invocation instanceof RpcInvocation) {
-                if (!result.hasException()) {
-                    Object value = result.getValue();
+                if (!appResponse.hasException()) {
+                    Object value = appResponse.getValue();
                     try {
                         Method method = invoker.getInterface().getMethod(methodName, parameterTypes);
                         if (ProtocolUtils.isBeanGenericSerialization(generic)) {
                             if (value == null) {
-                                result.setValue(value);
+                                appResponse.setValue(value);
                             } else if (value instanceof JavaBeanDescriptor) {
-                                result.setValue(JavaBeanSerializeUtil.deserialize((JavaBeanDescriptor) value));
+                                appResponse.setValue(JavaBeanSerializeUtil.deserialize((JavaBeanDescriptor) value));
                             } else {
                                 throw new RpcException("The type of result value is " + value.getClass().getName() + " other than " + JavaBeanDescriptor.class.getName() + ", and the result is " + value);
                             }
                         } else {
                             Type[] types = ReflectUtils.getReturnTypes(method);
-                            result.setValue(PojoUtils.realize(value, (Class<?>) types[0], types[1]));
+                            appResponse.setValue(PojoUtils.realize(value, (Class<?>) types[0], types[1]));
                         }
                     } catch (NoSuchMethodException e) {
                         throw new RpcException(e.getMessage(), e);
                     }
-                } else if (result.getException() instanceof GenericException) {
-                    GenericException exception = (GenericException) result.getException();
+                } else if (appResponse.getException() instanceof GenericException) {
+                    GenericException exception = (GenericException) appResponse.getException();
                     try {
                         String className = exception.getExceptionClass();
                         Class<?> clazz = ReflectUtils.forName(className);
@@ -177,7 +177,7 @@ public class GenericImplFilter extends ListenableFilter {
                             } catch (Throwable e) {
                                 logger.warn(e.getMessage(), e);
                             }
-                            result.setException(targetException);
+                            appResponse.setException(targetException);
                         } else if (lastException != null) {
                             throw lastException;
                         }
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TimeoutFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TimeoutFilter.java
index b633582..c51cd3d 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TimeoutFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TimeoutFilter.java
@@ -51,7 +51,7 @@ public class TimeoutFilter extends ListenableFilter {
     static class TimeoutListener implements Listener {
 
         @Override
-        public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
+        public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
             String startAttach = invocation.getAttachment(TIMEOUT_FILTER_START_TIME);
             if (startAttach != null) {
                 long elapsed = System.currentTimeMillis() - Long.valueOf(startAttach);
diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcResultTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcResultTest.java
index 859772b..8bcf31a 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcResultTest.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcResultTest.java
@@ -26,9 +26,9 @@ public class RpcResultTest {
     @Test
     public void testRecreateWithNormalException() {
         NullPointerException npe = new NullPointerException();
-        AppResponse rpcResult = new AppResponse(npe);
+        AppResponse appResponse = new AppResponse(npe);
         try {
-            rpcResult.recreate();
+            appResponse.recreate();
             fail();
         } catch (Throwable throwable) {
             StackTraceElement[] stackTrace = throwable.getStackTrace();
@@ -64,9 +64,9 @@ public class RpcResultTest {
         }
         // end construct a NullPointerException with empty stackTrace
 
-        AppResponse rpcResult = new AppResponse(throwable);
+        AppResponse appResponse = new AppResponse(throwable);
         try {
-            rpcResult.recreate();
+            appResponse.recreate();
             fail();
         } catch (Throwable t) {
             StackTraceElement[] stackTrace = t.getStackTrace();
diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java
index e16dfbd..709401d 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java
@@ -105,9 +105,9 @@ public class CompatibleFilterFilterTest {
         given(invoker.getUrl()).willReturn(url);
 
         Result asyncResult = compatibleFilter.invoke(invoker, invocation);
-        Result rpcResult = asyncResult.get();
-        compatibleFilter.listener().onResponse(rpcResult, invoker, invocation);
-        assertEquals(Type.High, rpcResult.getValue());
+        AppResponse appResponse = (AppResponse) asyncResult.get();
+        compatibleFilter.listener().onResponse(appResponse, invoker, invocation);
+        assertEquals(Type.High, appResponse.getValue());
     }
 
     @Test
@@ -127,9 +127,9 @@ public class CompatibleFilterFilterTest {
         given(invoker.getUrl()).willReturn(url);
 
         Result asyncResult = compatibleFilter.invoke(invoker, invocation);
-        Result rpcResult = asyncResult.get();
-        compatibleFilter.listener().onResponse(rpcResult, invoker, invocation);
-        assertEquals(Type.High, rpcResult.getValue());
+        AppResponse appResponse = (AppResponse) asyncResult.get();
+        compatibleFilter.listener().onResponse(appResponse, invoker, invocation);
+        assertEquals(Type.High, appResponse.getValue());
     }
 
     @Test
diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java
index 964e06e..49af0c0 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java
@@ -28,7 +28,6 @@ import org.apache.dubbo.rpc.support.DemoService;
 import org.apache.dubbo.rpc.support.LocalException;
 
 import com.alibaba.com.caucho.hessian.HessianException;
-
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
@@ -80,16 +79,16 @@ public class ExceptionFilterTest {
         ExceptionFilter exceptionFilter = new ExceptionFilter();
         RpcInvocation invocation = new RpcInvocation("sayHello", new Class<?>[]{String.class}, new Object[]{"world"});
 
-        AppResponse rpcResult = new AppResponse();
-        rpcResult.setException(new IllegalArgumentException("java"));
+        AppResponse appResponse = new AppResponse();
+        appResponse.setException(new IllegalArgumentException("java"));
 
         Invoker<DemoService> invoker = mock(Invoker.class);
-        when(invoker.invoke(invocation)).thenReturn(rpcResult);
+        when(invoker.invoke(invocation)).thenReturn(appResponse);
         when(invoker.getInterface()).thenReturn(DemoService.class);
 
         Result newResult = exceptionFilter.invoke(invoker, invocation);
 
-        Assertions.assertEquals(rpcResult.getException(), newResult.getException());
+        Assertions.assertEquals(appResponse.getException(), newResult.getException());
 
     }
 
@@ -100,16 +99,16 @@ public class ExceptionFilterTest {
         ExceptionFilter exceptionFilter = new ExceptionFilter();
         RpcInvocation invocation = new RpcInvocation("sayHello", new Class<?>[]{String.class}, new Object[]{"world"});
 
-        AppResponse rpcResult = new AppResponse();
-        rpcResult.setException(new LocalException("localException"));
+        AppResponse appResponse = new AppResponse();
+        appResponse.setException(new LocalException("localException"));
 
         Invoker<DemoService> invoker = mock(Invoker.class);
-        when(invoker.invoke(invocation)).thenReturn(rpcResult);
+        when(invoker.invoke(invocation)).thenReturn(appResponse);
         when(invoker.getInterface()).thenReturn(DemoService.class);
 
         Result newResult = exceptionFilter.invoke(invoker, invocation);
 
-        Assertions.assertEquals(rpcResult.getException(), newResult.getException());
+        Assertions.assertEquals(appResponse.getException(), newResult.getException());
 
     }
 
@@ -131,12 +130,12 @@ public class ExceptionFilterTest {
 
         Result asyncResult = exceptionFilter.invoke(invoker, invocation);
 
-        Result rpcResult = asyncResult.get();
-        exceptionFilter.listener().onResponse(rpcResult, invoker, invocation);
+        AppResponse appResponse = (AppResponse) asyncResult.get();
+        exceptionFilter.listener().onResponse(appResponse, invoker, invocation);
 
-        Assertions.assertFalse(rpcResult.getException() instanceof HessianException);
+        Assertions.assertFalse(appResponse.getException() instanceof HessianException);
 
-        Assertions.assertEquals(rpcResult.getException().getClass(), RuntimeException.class);
+        Assertions.assertEquals(appResponse.getException().getClass(), RuntimeException.class);
     }
 
 }
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java
index f2358dd..35fae84 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java
@@ -64,10 +64,10 @@ public class GenericFilterTest {
 
         Result asyncResult = genericFilter.invoke(invoker, invocation);
 
-        Result rpcResult = asyncResult.get();
-        genericFilter.listener().onResponse(rpcResult, invoker, invocation);
-        Assertions.assertEquals(HashMap.class, rpcResult.getValue().getClass());
-        Assertions.assertEquals(10, ((HashMap) rpcResult.getValue()).get("age"));
+        AppResponse appResponse = (AppResponse) asyncResult.get();
+        genericFilter.listener().onResponse(appResponse, invoker, invocation);
+        Assertions.assertEquals(HashMap.class, appResponse.getValue().getClass());
+        Assertions.assertEquals(10, ((HashMap) appResponse.getValue()).get("age"));
 
     }
 
diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java
index 1c0103e..caaf214 100644
--- a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java
+++ b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java
@@ -376,15 +376,15 @@ public class ThriftCodec implements Codec2 {
 
             response.setId(id);
 
-            AppResponse rpcResult = new AppResponse();
+            AppResponse appResponse = new AppResponse();
 
             if (realResult instanceof Throwable) {
-                rpcResult.setException((Throwable) realResult);
+                appResponse.setException((Throwable) realResult);
             } else {
-                rpcResult.setValue(realResult);
+                appResponse.setValue(realResult);
             }
 
-            response.setResult(rpcResult);
+            response.setResult(appResponse);
 
             return response;
 
diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodecTest.java b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodecTest.java
index c7b34dd..8e33af1 100644
--- a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodecTest.java
+++ b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodecTest.java
@@ -276,11 +276,11 @@ public class ThriftCodecTest {
 
         Request request = createRequest();
 
-        AppResponse rpcResult = new AppResponse();
-        rpcResult.setValue("Hello, World!");
+        AppResponse appResponse = new AppResponse();
+        appResponse.setValue("Hello, World!");
 
         Response response = new Response();
-        response.setResult(rpcResult);
+        response.setResult(appResponse);
         response.setId(request.getId());
         ChannelBuffer bos = ChannelBuffers.dynamicBuffer(1024);
 
@@ -322,7 +322,7 @@ public class ThriftCodecTest {
         result.read(protocol);
         protocol.readMessageEnd();
 
-        Assertions.assertEquals(rpcResult.getValue(), result.getSuccess());
+        Assertions.assertEquals(appResponse.getValue(), result.getSuccess());
     }
 
     @Test
@@ -334,12 +334,12 @@ public class ThriftCodecTest {
 
         Request request = createRequest();
 
-        AppResponse rpcResult = new AppResponse();
+        AppResponse appResponse = new AppResponse();
         String exceptionMessage = "failed";
-        rpcResult.setException(new RuntimeException(exceptionMessage));
+        appResponse.setException(new RuntimeException(exceptionMessage));
 
         Response response = new Response();
-        response.setResult(rpcResult);
+        response.setResult(appResponse);
         response.setId(request.getId());
         ChannelBuffer bos = ChannelBuffers.dynamicBuffer(1024);