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 2021/12/13 02:24:54 UTC

[dubbo] branch 3.0.5-release updated: fix: Update the version of log4j for bug fixes (#9377)

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

liujun pushed a commit to branch 3.0.5-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0.5-release by this push:
     new dd539ce  fix: Update the version of log4j for bug fixes (#9377)
dd539ce is described below

commit dd539ce4b45fe367d8e1f9005d27a260b85ab56b
Author: Pin Xiong <pi...@foxmail.com>
AuthorDate: Mon Dec 13 10:24:39 2021 +0800

    fix: Update the version of log4j for bug fixes (#9377)
---
 .../org/apache/dubbo/rpc/cluster/RouterChain.java  |  3 +++
 .../dubbo/rpc/cluster/router/state/BitList.java    | 18 ++++++++++++-
 .../cluster/router/state/StateRouterResult.java    | 30 ++++++++++++++++++++++
 .../dubbo/rpc/model/ModuleServiceRepository.java   |  2 ++
 dubbo-config/dubbo-config-spring/pom.xml           |  5 ++++
 .../dubbo-demo-spring-boot-consumer/pom.xml        |  7 +++++
 .../dubbo-demo-spring-boot-provider/pom.xml        |  7 +++++
 dubbo-dependencies-bom/pom.xml                     |  3 ++-
 .../dubbo-spring-boot-actuator/pom.xml             | 20 +++++++++++++++
 .../dubbo-spring-boot-autoconfigure/pom.xml        | 14 ++++++++++
 .../dubbo-spring-boot-compatible/actuator/pom.xml  |  7 +++++
 .../autoconfigure/pom.xml                          | 14 ++++++++++
 .../dubbo-spring-boot-starter/pom.xml              | 13 ++++++++++
 dubbo-spring-boot/pom.xml                          |  2 ++
 14 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
index fae9062..12e32c7 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
@@ -170,6 +170,9 @@ public class RouterChain<T> {
         }
 
 
+        if (routers.isEmpty()) {
+            return resultInvokers;
+        }
         List<Invoker<T>> commonRouterResult = new ArrayList<>(resultInvokers);
         // 2. route common router
         for (Router router : routers) {
diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/BitList.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/BitList.java
index 359e2ed..52e80cb 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/BitList.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/BitList.java
@@ -60,7 +60,11 @@ public class BitList<E> extends AbstractList<E> {
     }
 
     public BitList(List<E> originList, boolean empty) {
-        this.originList = originList;
+        if (originList instanceof BitList) {
+            this.originList = ((BitList<E>) originList).getOriginList();
+        } else {
+            this.originList = originList;
+        }
         this.rootSet = new BitSet();
         if (!empty) {
             this.rootSet.set(0, originList.size());
@@ -82,6 +86,18 @@ public class BitList<E> extends AbstractList<E> {
         this.rootSet.set(index);
     }
 
+    public int totalSetSize() {
+        return this.originList.size();
+    }
+
+    public boolean indexExist(int index) {
+        return this.rootSet.get(index);
+    }
+
+    public E getByIndex(int index) {
+        return this.originList.get(index);
+    }
+
     /**
      * And operation between two bitList. Return a new cloned list.
      * TailList in source bitList will be totally saved even if it is not appeared in the target bitList.
diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterResult.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterResult.java
index b59d569..b4fb316 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterResult.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterResult.java
@@ -27,18 +27,48 @@ public class StateRouterResult<T> {
         this.message = null;
     }
 
+    public StateRouterResult(BitList<T> invokers, BitList<T> routedResult) {
+        this.needContinueRoute = true;
+        this.result = invokers.and(routedResult);
+        this.message = null;
+    }
+
     public StateRouterResult(BitList<T> result, String message) {
         this.needContinueRoute = true;
         this.result = result;
         this.message = message;
     }
 
+    public StateRouterResult(BitList<T> invokers, BitList<T> routedResult, String message) {
+        this.needContinueRoute = true;
+        this.result = invokers.and(routedResult);
+        this.message = message;
+    }
+
+    public StateRouterResult(boolean needContinueRoute, BitList<T> result) {
+        this.needContinueRoute = needContinueRoute;
+        this.result = result;
+        this.message = null;
+    }
+
+    public StateRouterResult(boolean needContinueRoute, BitList<T> invokers, BitList<T> routedResult) {
+        this.needContinueRoute = needContinueRoute;
+        this.result = invokers.and(routedResult);
+        this.message = null;
+    }
+
     public StateRouterResult(boolean needContinueRoute, BitList<T> result, String message) {
         this.needContinueRoute = needContinueRoute;
         this.result = result;
         this.message = message;
     }
 
+    public StateRouterResult(boolean needContinueRoute, BitList<T> invokers, BitList<T> routedResult, String message) {
+        this.needContinueRoute = needContinueRoute;
+        this.result = invokers.and(routedResult);
+        this.message = message;
+    }
+
     public boolean isNeedContinueRoute() {
         return needContinueRoute;
     }
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java
index 9710eb55..b16a669 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ModuleServiceRepository.java
@@ -150,8 +150,10 @@ public class ModuleServiceRepository {
     @Deprecated
     public void reRegisterProvider(String newServiceKey, String serviceKey) {
         ProviderModel providerModel = this.providers.get(serviceKey);
+        frameworkServiceRepository.unregisterProvider(providerModel);
         providerModel.setServiceKey(newServiceKey);
         this.providers.putIfAbsent(newServiceKey, providerModel);
+        frameworkServiceRepository.registerProvider(providerModel);
         this.providers.remove(serviceKey);
     }
 
diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml
index 648d6e3..1baf323 100644
--- a/dubbo-config/dubbo-config-spring/pom.xml
+++ b/dubbo-config/dubbo-config-spring/pom.xml
@@ -152,6 +152,11 @@
                     <artifactId>junit-vintage-engine</artifactId>
                     <groupId>org.junit.vintage</groupId>
                 </exclusion>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
diff --git a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-consumer/pom.xml b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-consumer/pom.xml
index 24aeb0e..570ab67 100644
--- a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-consumer/pom.xml
+++ b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-consumer/pom.xml
@@ -102,6 +102,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-logging</artifactId>
             <version>${spring-boot.version}</version>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
diff --git a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-provider/pom.xml b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-provider/pom.xml
index ebb8178..c106da6 100644
--- a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-provider/pom.xml
+++ b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-provider/pom.xml
@@ -102,6 +102,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-logging</artifactId>
             <version>${spring-boot.version}</version>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml
index 24d4714..fe6da7d 100644
--- a/dubbo-dependencies-bom/pom.xml
+++ b/dubbo-dependencies-bom/pom.xml
@@ -139,7 +139,8 @@
         <jcl_version>1.2</jcl_version>
         <log4j_version>1.2.16</log4j_version>
         <logback_version>1.2.2</logback_version>
-        <log4j2_version>2.11.1</log4j2_version>
+        <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+        <log4j2_version>2.15.0</log4j2_version>
         <commons_io_version>2.6</commons_io_version>
 
         <embedded_redis_version>0.10.0</embedded_redis_version>
diff --git a/dubbo-spring-boot/dubbo-spring-boot-actuator/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-actuator/pom.xml
index c0ec869..b39fee0 100644
--- a/dubbo-spring-boot/dubbo-spring-boot-actuator/pom.xml
+++ b/dubbo-spring-boot/dubbo-spring-boot-actuator/pom.xml
@@ -43,6 +43,19 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
             <optional>true</optional>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>${log4j2_version}</version>
+            <optional>true</optional>
         </dependency>
 
         <dependency>
@@ -111,6 +124,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
diff --git a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/pom.xml
index 80a063b..30ddd03 100644
--- a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/pom.xml
+++ b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/pom.xml
@@ -51,6 +51,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-logging</artifactId>
             <optional>true</optional>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <!-- Dubbo -->
@@ -79,6 +86,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
     </dependencies>
diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/actuator/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-compatible/actuator/pom.xml
index 23af658..a1a84ec 100644
--- a/dubbo-spring-boot/dubbo-spring-boot-compatible/actuator/pom.xml
+++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/actuator/pom.xml
@@ -101,6 +101,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
     </dependencies>
diff --git a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml
index e99f6b7..dc940e5 100644
--- a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml
+++ b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/pom.xml
@@ -48,6 +48,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-logging</artifactId>
             <optional>true</optional>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <!-- @ConfigurationProperties annotation processing (metadata for IDEs) -->
@@ -82,6 +89,13 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
     </dependencies>
diff --git a/dubbo-spring-boot/dubbo-spring-boot-starter/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-starter/pom.xml
index 763795b..cb1ce7a 100644
--- a/dubbo-spring-boot/dubbo-spring-boot-starter/pom.xml
+++ b/dubbo-spring-boot/dubbo-spring-boot-starter/pom.xml
@@ -37,6 +37,19 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter</artifactId>
             <optional>true</optional>
+            <exclusions>
+                <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>${log4j2_version}</version>
+            <optional>true</optional>
         </dependency>
 
         <dependency>
diff --git a/dubbo-spring-boot/pom.xml b/dubbo-spring-boot/pom.xml
index 2f52e8a..4018a46 100644
--- a/dubbo-spring-boot/pom.xml
+++ b/dubbo-spring-boot/pom.xml
@@ -41,6 +41,8 @@
     <properties>
         <spring-boot.version>2.3.1.RELEASE</spring-boot.version>
         <dubbo.version>${revision}</dubbo.version>
+        <!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
+        <log4j2_version>2.15.0</log4j2_version>
     </properties>
 
     <dependencyManagement>