optimize the RondRobinLoadBalance and MockClusterInvoker (#2932)
authorXiaoJie Li <lixiaojie_dev@outlook.com>
Mon, 10 Dec 2018 11:04:00 +0000 (19:04 +0800)
committer时无两丶 <442367943@qq.com>
Mon, 10 Dec 2018 11:04:00 +0000 (19:04 +0800)
delete unused logic and take the logger out.

dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalance.java
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java

index f0bd58e..242a2ff 100644 (file)
@@ -108,7 +108,6 @@ public class RoundRobinLoadBalance extends AbstractLoadBalance {
                 weightedRoundRobin = new WeightedRoundRobin();\r
                 weightedRoundRobin.setWeight(weight);\r
                 map.putIfAbsent(identifyString, weightedRoundRobin);\r
-                weightedRoundRobin = map.get(identifyString);\r
             }\r
             if (weight != weightedRoundRobin.getWeight()) {\r
                 //weight changed\r
index a8a984e..2fd1af9 100644 (file)
@@ -86,12 +86,12 @@ public class MockClusterInvoker<T> implements Invoker<T> {
             } catch (RpcException e) {\r
                 if (e.isBiz()) {\r
                     throw e;\r
-                } else {\r
-                    if (logger.isWarnEnabled()) {\r
-                        logger.warn("fail-mock: " + invocation.getMethodName() + " fail-mock enabled , url : " + directory.getUrl(), e);\r
-                    }\r
-                    result = doMockInvoke(invocation, e);\r
                 }\r
+                \r
+                if (logger.isWarnEnabled()) {\r
+                    logger.warn("fail-mock: " + invocation.getMethodName() + " fail-mock enabled , url : " + directory.getUrl(), e);\r
+                }\r
+                result = doMockInvoke(invocation, e);\r
             }\r
         }\r
         return result;\r