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/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a87dc5  Merge pull request #3017, fixes #2981, refresh invocation's 
attachments in each invoke.
6a87dc5 is described below

commit 6a87dc559cfa6aafd59097e7359634bf4fdbdc5c
Author: 时无两丶 <[email protected]>
AuthorDate: Thu Jan 24 20:12:06 2019 +0800

    Merge pull request #3017, fixes #2981, refresh invocation's attachments in 
each invoke.
    
    Fixes #2981.
---
 .../cluster/support/AbstractClusterInvoker.java    | 26 +++++++++++-----------
 .../org/apache/dubbo/rpc/filter/ContextFilter.java |  3 ++-
 .../apache/dubbo/rpc/protocol/AbstractInvoker.java |  1 -
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
index 63486aa..abc9cf2 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
@@ -109,10 +109,10 @@ public abstract class AbstractClusterInvoker<T> 
implements Invoker<T> {
      * @param invokers    invoker candidates
      * @param selected    exclude selected invokers or not
      * @return the invoker which will final to do invoke.
-     * @throws RpcException
+     * @throws RpcException exception
      */
     protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation,
-        List<Invoker<T>> invokers, List<Invoker<T>> selected) throws 
RpcException {
+                                List<Invoker<T>> invokers, List<Invoker<T>> 
selected) throws RpcException {
 
         if (CollectionUtils.isEmpty(invokers)) {
             return null;
@@ -120,7 +120,7 @@ public abstract class AbstractClusterInvoker<T> implements 
Invoker<T> {
         String methodName = invocation == null ? StringUtils.EMPTY : 
invocation.getMethodName();
 
         boolean sticky = invokers.get(0).getUrl()
-            .getMethodParameter(methodName, Constants.CLUSTER_STICKY_KEY, 
Constants.DEFAULT_CLUSTER_STICKY);
+                .getMethodParameter(methodName, Constants.CLUSTER_STICKY_KEY, 
Constants.DEFAULT_CLUSTER_STICKY);
 
         //ignore overloaded method
         if (stickyInvoker != null && !invokers.contains(stickyInvoker)) {
@@ -142,7 +142,7 @@ public abstract class AbstractClusterInvoker<T> implements 
Invoker<T> {
     }
 
     private Invoker<T> doSelect(LoadBalance loadbalance, Invocation invocation,
-        List<Invoker<T>> invokers, List<Invoker<T>> selected) throws 
RpcException {
+                                List<Invoker<T>> invokers, List<Invoker<T>> 
selected) throws RpcException {
 
         if (CollectionUtils.isEmpty(invokers)) {
             return null;
@@ -180,19 +180,20 @@ public abstract class AbstractClusterInvoker<T> 
implements Invoker<T> {
      * Reselect, use invokers not in `selected` first, if all invokers are in 
`selected`,
      * just pick an available one using loadbalance policy.
      *
-     * @param loadbalance
-     * @param invocation
-     * @param invokers
-     * @param selected
-     * @return
-     * @throws RpcException
+     * @param loadbalance    load balance policy
+     * @param invocation     invocation
+     * @param invokers       invoker candidates
+     * @param selected       exclude selected invokers or not
+     * @param availablecheck check invoker available if true
+     * @return the reselect result to do invoke
+     * @throws RpcException exception
      */
     private Invoker<T> reselect(LoadBalance loadbalance, Invocation invocation,
-        List<Invoker<T>> invokers, List<Invoker<T>> selected, boolean 
availablecheck) throws RpcException {
+                                List<Invoker<T>> invokers, List<Invoker<T>> 
selected, boolean availablecheck) throws RpcException {
 
         //Allocating one in advance, this list is certain to be used.
         List<Invoker<T>> reselectInvokers = new ArrayList<>(
-            invokers.size() > 1 ? (invokers.size() - 1) : invokers.size());
+                invokers.size() > 1 ? (invokers.size() - 1) : invokers.size());
 
         // First, try picking a invoker not in `selected`.
         for (Invoker<T> invoker : invokers) {
@@ -242,7 +243,6 @@ public abstract class AbstractClusterInvoker<T> implements 
Invoker<T> {
     }
 
     protected void checkWhetherDestroyed() {
-
         if (destroyed.get()) {
             throw new RpcException("Rpc cluster invoker for " + getInterface() 
+ " on consumer " + NetUtils.getLocalHost()
                     + " use dubbo version " + Version.getVersion()
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 db68ea1..7f30151 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
@@ -42,8 +42,9 @@ public class ContextFilter implements Filter {
     public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
         Map<String, String> attachments = invocation.getAttachments();
         if (attachments != null) {
-            attachments = new HashMap<String, String>(attachments);
+            attachments = new HashMap<>(attachments);
             attachments.remove(Constants.PATH_KEY);
+            attachments.remove(Constants.INTERFACE_KEY);
             attachments.remove(Constants.GROUP_KEY);
             attachments.remove(Constants.VERSION_KEY);
             attachments.remove(Constants.DUBBO_VERSION_KEY);
diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
index 4979916..d59af2b 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java
@@ -152,7 +152,6 @@ public abstract class AbstractInvoker<T> implements 
Invoker<T> {
         }
         RpcUtils.attachInvocationIdIfAsync(getUrl(), invocation);
 
-
         try {
             return doInvoke(invocation);
         } catch (InvocationTargetException e) { // biz exception

Reply via email to