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/10/30 03:28:14 UTC
[dubbo] branch master updated: adjust onResponse method for
compatibility purpose.
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 9a32817 adjust onResponse method for compatibility purpose.
9a32817 is described below
commit 9a32817764abff8f06e4fad911dd69cede3b3723
Author: ken.lj <ke...@gmail.com>
AuthorDate: Wed Oct 30 11:27:59 2019 +0800
adjust onResponse method for compatibility purpose.
---
.../src/main/java/org/apache/dubbo/rpc/Filter.java | 27 +++++++++++-----------
.../dubbo/rpc/protocol/ProtocolFilterWrapper.java | 2 --
2 files changed, 13 insertions(+), 16 deletions(-)
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 8a06807..42158b7 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
@@ -43,25 +43,24 @@ import org.apache.dubbo.common.extension.SPI;
@SPI
public interface Filter {
/**
- * Does not need to override/implement this method.
+ * Make sure call invoker.invoke() in your implementation.
*/
Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException;
- /**
- * Filter itself should only be response for passing invocation, all callbacks has been placed into {@link Listener}
- *
- * @param appResponse
- * @param invoker
- * @param invocation
- * @return
- */
- @Deprecated
- default Result onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
- return appResponse;
- }
-
interface Listener {
+ /**
+ * Please use {@link #onMessage(Result, Invoker, Invocation)} instead.
+ * This method is kept only compatibility and may get removed at any version in the future.
+ *
+ * @param appResponse
+ * @param invoker
+ * @param invocation
+ */
+ @Deprecated
+ default void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
+ }
+
void onMessage(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/protocol/ProtocolFilterWrapper.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/ProtocolFilterWrapper.java
index 5d5a3a8..a8d8e45 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/ProtocolFilterWrapper.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/ProtocolFilterWrapper.java
@@ -108,8 +108,6 @@ public class ProtocolFilterWrapper implements Protocol {
} else {
listener.onError(t, invoker, invocation);
}
- } else {
- filter.onResponse(r, invoker, invocation);
}
});
}