This is an automated email from the ASF dual-hosted git repository.
songxiaosheng pushed a commit to branch 3.1.0
in repository https://gitbox.apache.org/repos/asf/dubbo-spi-extensions.git
The following commit(s) were added to refs/heads/3.1.0 by this push:
new a227f52 Cherry-pick bug fix from master into 3.1.0 branch (#334)
a227f52 is described below
commit a227f5289e46503e42a70721db22a247b965d9a1
Author: aofall <[email protected]>
AuthorDate: Fri Apr 26 08:36:28 2024 +0800
Cherry-pick bug fix from master into 3.1.0 branch (#334)
* [Dubbo-267] Fix protobuf type lose field when deepCopy inJvmInvoker
Class. (#268)
* fix: dubbo-registry-dns resource leak (#308)
* fix: dubbo-registry-dns memory leak && add try catch
* revert junit
(cherry picked from commit b3033debb4e0277ad865b8b78f54652e24af9100)
* fix: redis connection do not close and return to connection pool (#311)
(cherry picked from commit cbad15d8767e72c539cae0f3abeb8885338948a6)
* fix test lib (#310)
* fix test lib
* remove useless dependency
* remove useless dependency
* fix bad test
* TimeoutException Increase time
* Revert "TimeoutException Increase time"
This reverts commit 5e5bb32bc3f26faf2ba318fafc16e9ca96232872.
* add MinaClientToServerTest disable
(cherry picked from commit f38363fc96817e46af8ea6c3f8ae07701976aedf)
* build: add Windows platform unit test for CI && add dependabot config
* chore: create etcd for each unit test
* chore: already check license by apache skywalking-eyes so skip
rat-license check
* Revert "chore: already check license by apache skywalking-eyes so skip
rat-license check"
This reverts commit 98d627b3fe94394712d86ba4aaf13cacf524f50b.
* fix: rat-check failed
---------
Co-authored-by: MaruHibiki <[email protected]>
Co-authored-by: 王聪洋 <[email protected]>
---
.github/dependabot.yaml | 15 +++
.github/workflows/build-and-test-pr.yml | 60 +++++++----
.github/workflows/build-and-test-scheduled-3.1.yml | 58 +++++++---
.github/workflows/release-test.yml | 80 ++++++++++----
.../support/etcd/EtcdDynamicConfigurationTest.java | 8 +-
dubbo-extensions-dependencies-bom/pom.xml | 119 +++++++++++++++++++--
.../dubbo/registry/dns/DNSServiceDiscovery.java | 11 +-
.../dubbo/registry/dns/util/DNSResolver.java | 1 +
.../registry/dns/{util => }/DNSResolverTest.java | 8 +-
.../remoting/redis/jedis/ClusterRedisClient.java | 5 +-
.../remoting/redis/jedis/MonoRedisClient.java | 10 +-
.../remoting/redis/jedis/SentinelRedisClient.java | 14 +--
.../dubbo-serialization-protobuf/pom.xml | 7 +-
.../support/ProtobufParamDeepCopyUtil.java | 66 ++++++++++++
...ache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil | 1 +
.../support/ProtobufParamDeepCopyUtilTest.java | 74 +++++++++++++
pom.xml | 39 ++++++-
17 files changed, 488 insertions(+), 88 deletions(-)
diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml
new file mode 100644
index 0000000..805733a
--- /dev/null
+++ b/.github/dependabot.yaml
@@ -0,0 +1,15 @@
+version: 2
+updates:
+
+ - package-ecosystem: "maven"
+ directory: "/"
+ open-pull-requests-limit: 20
+ # Ignore major version updates
+ ignore:
+ - dependency-name: "*"
+ update-types: ["version-update:semver-major"]
+ schedule:
+ interval: "weekly"
+ day: "monday"
+ time: "03:00"
+ timezone: "US/Eastern"
diff --git a/.github/workflows/build-and-test-pr.yml
b/.github/workflows/build-and-test-pr.yml
index 9ddbc5c..8dcdee3 100644
--- a/.github/workflows/build-and-test-pr.yml
+++ b/.github/workflows/build-and-test-pr.yml
@@ -23,9 +23,10 @@ jobs:
name: "Check License"
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - name: Checkout
+ uses: actions/checkout@v4
- name: Check License
- uses: apache/skywalking-eyes@e1a02359b239bd28de3f6d35fdc870250fa513d5
+ uses: apache/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Set up JDK 21"
@@ -34,7 +35,7 @@ jobs:
distribution: 'zulu'
java-version: 21
- name: Restore Maven local repository cache
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -52,10 +53,17 @@ jobs:
build-tools:
name: "Build-tools"
needs: check-license
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ ubuntu-latest, windows-latest ]
+ fail-fast: false
outputs:
cache-key: ${{ steps.dubbo-build-tools.cache }}
steps:
+ - name: Support long paths on Windows
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ run: git config --system core.longpaths true
- uses: actions/checkout@v4
name: build tools
with:
@@ -67,7 +75,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 21
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -95,7 +103,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 8
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -140,7 +148,7 @@ jobs:
# Download dependencies Prepare for unit test
unit-test-prepare:
name: "Preparation for Unit Test On ${{ matrix.os }}"
- needs: [check-license, build-source]
+ needs: [check-license]
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -149,7 +157,7 @@ jobs:
env:
ZOOKEEPER_VERSION: 3.6.3
steps:
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache zookeeper binary archive"
id: "cache-zookeeper"
with:
@@ -187,7 +195,7 @@ jobs:
wget -c http://mirror.apache-kr.org/apache/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
echo "list the downloaded zookeeper binary archive"
ls -al ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache secret key"
id: "cache-secret-cert"
with:
@@ -206,8 +214,8 @@ jobs:
# Start unit test
unit-test:
needs: [check-license, build-source, unit-test-prepare]
- name: "Unit Test On ${{ matrix.os }} with JDK ${{ matrix.jdk }}"
- runs-on: ubuntu-latest
+ name: "Unit Test ${{ matrix.os }} with JDK ${{ matrix.jdk }}"
+ runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
@@ -218,6 +226,10 @@ jobs:
CURRENT_ROLE: ${{ matrix.case-role }}
DUBBO_DEFAULT_SERIALIZATION: fastjson2
steps:
+ - name: Support Windows
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ run: |
+ git config --system core.longpaths true
- uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -226,7 +238,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 8
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -234,7 +246,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache zookeeper binary archive"
id: "cache-zookeeper"
with:
@@ -242,7 +254,7 @@ jobs:
key: zookeeper-${{ runner.os }}-${{ env.ZOOKEEPER_VERSION }}
restore-keys: |
zookeeper-${{ runner.os }}-
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache secret key"
id: "cache-secret-cert"
with:
@@ -262,14 +274,26 @@ jobs:
# run: |
# source ${{ github.workspace }}/.tmp/decrypted-sonarcloud-token
# ./mvnw --batch-mode --no-snapshot-updates -e
--no-transfer-progress --fail-fast clean test verify
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089
-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache
-Dsonar.projectKey=apache_dubbo -DtrimStackTrace=false
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false
-DskipIntegrationTests=false -Dcheckstyle.skip [...]
- - name: "Test with Maven without SonarCloud Scan"
+ - name: "Test with Maven without SonarCloud Scan On Linux"
+ if: ${{ startsWith( matrix.os, 'linux') || startsWith( matrix.os,
'ubuntu') }}
timeout-minutes: 70
run: |
- ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089 -DtrimStackTrace=false
-Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false
-DskipIntegrationTests=false -Dcheckstyle.skip=false
-Dcheckstyle_unix.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
-DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper
+ ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-D"maven.wagon.httpconnectionManager.ttlSeconds=120" -Pjacoco
-DtrimStackTrace=false -D"maven.wagon.http.retryHandler.count=5"
-DskipTests=false -DskipIntegrationTests=false -D"checkstyle.skip=false"
-D"checkstyle_unix.skip=false" -D"rat.skip=false" -D"maven.javadoc.skip=true"
-D"embeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper"
+ - name: "Test with Maven without SonarCloud Scan On Windows"
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ timeout-minutes: 70
+ run: |
+ ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-D"maven.wagon.httpconnectionManager.ttlSeconds=120" -Pjacoco
-DtrimStackTrace=false -D"maven.wagon.http.retryHandler.count=5"
-DskipTests=false -DskipIntegrationTests=false -D"checkstyle.skip=false"
-D"checkstyle_unix.skip=true" -D"rat.skip=false" -D"maven.javadoc.skip=true"
-D"embeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper"
+ - name: "Upload surefire-reports if failure"
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: surefire-reports-${{ matrix.os }}-${{ matrix.jdk }}
+ path: "**/target/surefire-reports/**"
- name: "Upload coverage result"
uses: actions/upload-artifact@v4
with:
- name: coverage-result-${{ matrix.os }}-jdk${{ matrix.jdk }}
+ name: coverage-result-${{ matrix.os }}-${{ matrix.jdk }}
path: "**/target/site/**/jacoco.xml"
# error-code-inspecting:
@@ -290,7 +314,7 @@ jobs:
# distribution: 'zulu'
# java-version: 21
# - name: Restore Maven local repository cache
-# uses: actions/cache@v3
+# uses: actions/cache@v4
# with:
# path: ~/.m2/repository
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
diff --git a/.github/workflows/build-and-test-scheduled-3.1.yml
b/.github/workflows/build-and-test-scheduled-3.1.yml
index a54fa06..ec264fd 100644
--- a/.github/workflows/build-and-test-scheduled-3.1.yml
+++ b/.github/workflows/build-and-test-scheduled-3.1.yml
@@ -26,9 +26,12 @@ jobs:
name: "Check License"
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ ref: '3.1.0'
- name: Check License
- uses: apache/skywalking-eyes@e1a02359b239bd28de3f6d35fdc870250fa513d5
+ uses: apache/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Set up JDK 21"
@@ -37,7 +40,7 @@ jobs:
distribution: 'zulu'
java-version: 21
- name: Restore Maven local repository cache
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -55,10 +58,17 @@ jobs:
build-tools:
name: "Build-tools"
needs: check-license
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ ubuntu-latest, windows-latest ]
+ fail-fast: false
outputs:
cache-key: ${{ steps.dubbo-build-tools.cache }}
steps:
+ - name: Support long paths on Windows
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ run: git config --system core.longpaths true
- uses: actions/checkout@v4
name: build tools
with:
@@ -70,7 +80,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 21
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -99,7 +109,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 8
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -144,7 +154,7 @@ jobs:
# Download dependencies Prepare for unit test
unit-test-prepare:
name: "Preparation for Unit Test On ${{ matrix.os }}"
- needs: [check-license, build-source]
+ needs: [check-license]
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -153,7 +163,7 @@ jobs:
env:
ZOOKEEPER_VERSION: 3.6.3
steps:
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache zookeeper binary archive"
id: "cache-zookeeper"
with:
@@ -191,7 +201,7 @@ jobs:
wget -c http://mirror.apache-kr.org/apache/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
echo "list the downloaded zookeeper binary archive"
ls -al ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache secret key"
id: "cache-secret-cert"
with:
@@ -211,7 +221,7 @@ jobs:
unit-test:
needs: [check-license, build-source, unit-test-prepare]
name: "Unit Test ${{ matrix.os }} with JDK ${{ matrix.jdk }}"
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
@@ -222,6 +232,10 @@ jobs:
CURRENT_ROLE: ${{ matrix.case-role }}
DUBBO_DEFAULT_SERIALIZATION: fastjson2
steps:
+ - name: Support Windows
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ run: |
+ git config --system core.longpaths true
- uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -230,7 +244,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 8
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -238,7 +252,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache zookeeper binary archive"
id: "cache-zookeeper"
with:
@@ -246,7 +260,7 @@ jobs:
key: zookeeper-${{ runner.os }}-${{ env.ZOOKEEPER_VERSION }}
restore-keys: |
zookeeper-${{ runner.os }}-
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache secret key"
id: "cache-secret-cert"
with:
@@ -266,10 +280,22 @@ jobs:
# run: |
# source ${{ github.workspace }}/.tmp/decrypted-sonarcloud-token
# ./mvnw --batch-mode --no-snapshot-updates -e
--no-transfer-progress --fail-fast clean test verify
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089
-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache
-Dsonar.projectKey=apache_dubbo -DtrimStackTrace=false
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false
-DskipIntegrationTests=false -Dcheckstyle.skip [...]
- - name: "Test with Maven without SonarCloud Scan"
+ - name: "Test with Maven without SonarCloud Scan On Linux"
+ if: ${{ startsWith( matrix.os, 'linux') || startsWith( matrix.os,
'ubuntu') }}
timeout-minutes: 70
run: |
- ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089 -DtrimStackTrace=false
-Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false
-DskipIntegrationTests=false -Dcheckstyle.skip=false
-Dcheckstyle_unix.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
-DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper
+ ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-D"maven.wagon.httpconnectionManager.ttlSeconds=120" -Pjacoco
-DtrimStackTrace=false -D"maven.wagon.http.retryHandler.count=5"
-DskipTests=false -DskipIntegrationTests=false -D"checkstyle.skip=false"
-D"checkstyle_unix.skip=false" -D"rat.skip=false" -D"maven.javadoc.skip=true"
-D"embeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper"
+ - name: "Test with Maven without SonarCloud Scan On Windows"
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ timeout-minutes: 70
+ run: |
+ ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-D"maven.wagon.httpconnectionManager.ttlSeconds=120" -Pjacoco
-DtrimStackTrace=false -D"maven.wagon.http.retryHandler.count=5"
-DskipTests=false -DskipIntegrationTests=false -D"checkstyle.skip=false"
-D"checkstyle_unix.skip=true" -D"rat.skip=false" -D"maven.javadoc.skip=true"
-D"embeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper"
+ - name: "Upload surefire-reports if failure"
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: surefire-reports-${{ matrix.os }}-${{ matrix.jdk }}
+ path: "**/target/surefire-reports/**"
- name: "Upload coverage result"
uses: actions/upload-artifact@v4
with:
@@ -294,7 +320,7 @@ jobs:
# distribution: 'zulu'
# java-version: 21
# - name: Restore Maven local repository cache
-# uses: actions/cache@v3
+# uses: actions/cache@v4
# with:
# path: ~/.m2/repository
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
diff --git a/.github/workflows/release-test.yml
b/.github/workflows/release-test.yml
index 998fca3..0905728 100644
--- a/.github/workflows/release-test.yml
+++ b/.github/workflows/release-test.yml
@@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check License
- uses: apache/skywalking-eyes@e1a02359b239bd28de3f6d35fdc870250fa513d5
+ uses: apache/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Set up JDK 21"
@@ -38,7 +38,7 @@ jobs:
distribution: 'zulu'
java-version: 21
- name: Restore Maven local repository cache
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -56,10 +56,17 @@ jobs:
build-tools:
name: "Build-tools"
needs: check-license
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ ubuntu-latest, windows-latest ]
+ fail-fast: false
outputs:
cache-key: ${{ steps.dubbo-build-tools.cache }}
steps:
+ - name: Support long paths on Windows
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ run: git config --system core.longpaths true
- uses: actions/checkout@v4
name: build tools
with:
@@ -71,7 +78,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 21
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -86,8 +93,11 @@ jobs:
# Build from source code
build-source:
name: "Build Dubbo-SPI-Extensions"
- needs: [check-license, build-tools]
- runs-on: ubuntu-latest
+ needs: [check-license]
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ ubuntu-latest, windows-latest ]
# output dubbo-spi-extensions version to others jobs
outputs:
version: ${{ steps.dubbo-spi-extensions-version.outputs.version }}
@@ -99,7 +109,7 @@ jobs:
with:
distribution: 'zulu'
java-version: 8
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
@@ -144,16 +154,16 @@ jobs:
# Download dependencies Prepare for unit test
unit-test-prepare:
name: "Preparation for Unit Test On ${{ matrix.os }}"
- needs: [check-license, build-source]
+ needs: [check-license]
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [ ubuntu-latest, windows-latest]
+ os: [ ubuntu-latest, windows-latest ]
fail-fast: false
env:
ZOOKEEPER_VERSION: 3.6.3
steps:
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache zookeeper binary archive"
id: "cache-zookeeper"
with:
@@ -167,6 +177,20 @@ jobs:
with:
release: false # support cache, see
https://github.com/msys2/setup-msys2#context
- name: "Download zookeeper binary archive in Linux OS"
+ if: ${{ startsWith( matrix.os, 'ubuntu') &&
steps.cache-zookeeper.outputs.cache-hit != 'true' }}
+ run: |
+ mkdir -p ${{ github.workspace }}/.tmp/zookeeper
+ wget -c https://archive.apache.org/dist/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz ||
+ wget -c https://apache.website-solution.net/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz ||
+ wget -c http://apache.stu.edu.tw/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz ||
+ wget -c http://ftp.jaist.ac.jp/pub/apache/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz ||
+ wget -c http://apache.mirror.cdnetworks.com/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz ||
+ wget -c http://mirror.apache-kr.org/apache/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
+ echo "list the downloaded zookeeper binary archive"
+ ls -al ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
+ - name: "Download zookeeper binary archive in Windows OS"
+ if: ${{ startsWith( matrix.os, 'windows') &&
steps.cache-zookeeper.outputs.cache-hit != 'true' }}
+ shell: msys2 {0}
run: |
mkdir -p ${{ github.workspace }}/.tmp/zookeeper
wget -c https://archive.apache.org/dist/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz ||
@@ -177,7 +201,7 @@ jobs:
wget -c http://mirror.apache-kr.org/apache/zookeeper/zookeeper-${{
env.ZOOKEEPER_VERSION }}/apache-zookeeper-${{ env.ZOOKEEPER_VERSION
}}-bin.tar.gz -O ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
echo "list the downloaded zookeeper binary archive"
ls -al ${{ github.workspace
}}/.tmp/zookeeper/apache-zookeeper-bin.tar.gz
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache secret key"
id: "cache-secret-cert"
with:
@@ -196,8 +220,8 @@ jobs:
# Start unit test
unit-test:
needs: [check-license, build-source, unit-test-prepare]
- name: "Unit Test On ${{ matrix.os }} with JDK ${{ matrix.os }}"
- runs-on: ubuntu-latest
+ name: "Unit Test ${{ matrix.os }} with JDK ${{ matrix.jdk }}"
+ runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
@@ -208,6 +232,10 @@ jobs:
CURRENT_ROLE: ${{ matrix.case-role }}
DUBBO_DEFAULT_SERIALIZATION: fastjson2
steps:
+ - name: Support Windows
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ run: |
+ git config --system core.longpaths true
- uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -216,15 +244,15 @@ jobs:
with:
distribution: 'zulu'
java-version: 8
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
name: "Cache local Maven repository"
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{
github.run_id }}
restore-keys: |
- ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-maven-
- - uses: actions/cache@v3
+ ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ - uses: actions/cache@v4
name: "Cache zookeeper binary archive"
id: "cache-zookeeper"
with:
@@ -232,7 +260,13 @@ jobs:
key: zookeeper-${{ runner.os }}-${{ env.ZOOKEEPER_VERSION }}
restore-keys: |
zookeeper-${{ runner.os }}-
- - uses: actions/cache@v3
+ - name: "Upload surefire-reports if failure"
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: surefire-reports-${{ matrix.os }}-${{ matrix.jdk }}
+ path: "**/target/surefire-reports/**"
+ - uses: actions/cache@v4
name: "Cache secret key"
id: "cache-secret-cert"
with:
@@ -252,10 +286,16 @@ jobs:
# run: |
# source ${{ github.workspace }}/.tmp/decrypted-sonarcloud-token
# ./mvnw --batch-mode --no-snapshot-updates -e
--no-transfer-progress --fail-fast clean test verify
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089
-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache
-Dsonar.projectKey=apache_dubbo -DtrimStackTrace=false
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false
-DskipIntegrationTests=false -Dcheckstyle.skip [...]
- - name: "Test with Maven without SonarCloud Scan"
+ - name: "Test with Maven without SonarCloud Scan On Linux"
+ if: ${{ startsWith( matrix.os, 'linux') || startsWith( matrix.os,
'ubuntu') }}
+ timeout-minutes: 70
+ run: |
+ ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-D"maven.wagon.httpconnectionManager.ttlSeconds=120" -Pjacoco
-DtrimStackTrace=false -D"maven.wagon.http.retryHandler.count=5"
-DskipTests=false -DskipIntegrationTests=false -D"checkstyle.skip=false"
-D"checkstyle_unix.skip=false" -D"rat.skip=false" -D"maven.javadoc.skip=true"
-D"embeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper"
+ - name: "Test with Maven without SonarCloud Scan On Windows"
+ if: ${{ startsWith( matrix.os, 'windows') }}
timeout-minutes: 70
run: |
- ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
-Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089 -DtrimStackTrace=false
-Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false
-DskipIntegrationTests=false -Dcheckstyle.skip=false
-Dcheckstyle_unix.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
-DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper
+ ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress
--fail-fast clean test verify
-D"maven.wagon.httpconnectionManager.ttlSeconds=120" -Pjacoco
-DtrimStackTrace=false -D"maven.wagon.http.retryHandler.count=5"
-DskipTests=false -DskipIntegrationTests=false -D"checkstyle.skip=false"
-D"checkstyle_unix.skip=true" -D"rat.skip=false" -D"maven.javadoc.skip=true"
-D"embeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper"
- name: "Upload coverage result"
uses: actions/upload-artifact@v4
with:
@@ -280,7 +320,7 @@ jobs:
# distribution: 'zulu'
# java-version: 21
# - name: Restore Maven local repository cache
-# uses: actions/cache@v3
+# uses: actions/cache@v4
# with:
# path: ~/.m2/repository
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
diff --git
a/dubbo-configcenter-extensions/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
b/dubbo-configcenter-extensions/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
index e6ed4b5..60e6889 100644
---
a/dubbo-configcenter-extensions/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
+++
b/dubbo-configcenter-extensions/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
@@ -26,10 +26,10 @@ import io.etcd.jetcd.ByteSequence;
import io.etcd.jetcd.Client;
import io.etcd.jetcd.launcher.EtcdCluster;
import io.etcd.jetcd.launcher.EtcdClusterFactory;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import java.net.URI;
import java.util.HashMap;
@@ -128,7 +128,7 @@ public class EtcdDynamicConfigurationTest {
}
}
- @Before
+ @BeforeEach
public void setUp() {
etcdCluster.start();
@@ -146,7 +146,7 @@ public class EtcdDynamicConfigurationTest {
config = new EtcdDynamicConfiguration(url);
}
- @After
+ @AfterEach
public void tearDown() {
etcdCluster.close();
}
diff --git a/dubbo-extensions-dependencies-bom/pom.xml
b/dubbo-extensions-dependencies-bom/pom.xml
index 790b00e..bf9c56b 100644
--- a/dubbo-extensions-dependencies-bom/pom.xml
+++ b/dubbo-extensions-dependencies-bom/pom.xml
@@ -95,7 +95,7 @@
<spring-boot.version>2.4.1</spring-boot.version>
<!-- Fabric8 for Kubernetes -->
- <fabric8_kubernetes_version>5.3.2</fabric8_kubernetes_version>
+ <fabric8_kubernetes_version>6.9.2</fabric8_kubernetes_version>
<hessian_version>4.0.51</hessian_version>
<httpclient_version>4.5.13</httpclient_version>
<jsonrpc_version>1.2.0</jsonrpc_version>
@@ -108,7 +108,7 @@
<jaxb_version>2.2.7</jaxb_version>
<activation_version>1.2.0</activation_version>
<cxf_version>3.1.15</cxf_version>
- <avro_version>1.8.2</avro_version>
+ <avro_version>1.11.3</avro_version>
<fastjson_version>1.2.83</fastjson_version>
<fst_version>2.48-jdk-6</fst_version>
<fury_version>0.2.0</fury_version>
@@ -132,14 +132,19 @@
<seata_version>1.5.2</seata_version>
<eureka.version>1.9.12</eureka.version>
<sofa_registry_version>5.2.0</sofa_registry_version>
- <logback_version>1.2.11</logback_version>
+ <logback_version>1.3.12</logback_version>
<rs_api_version>2.0</rs_api_version>
- <resteasy_version>3.0.20.Final</resteasy_version>
+ <resteasy_version>3.15.6.Final</resteasy_version>
+ <codehaus-jackson_version>1.9.13</codehaus-jackson_version>
+ <swagger_version>1.6.14</swagger_version>
<polaris_adapter_version>0.2.1</polaris_adapter_version>
<maven_flatten_version>1.2.5</maven_flatten_version>
<byte-buddy.version>1.14.5</byte-buddy.version>
<commons_net_version>3.9.0</commons_net_version>
- <snakeyaml_version>2.0</snakeyaml_version>
+ <snakeyaml_version>2.2</snakeyaml_version>
+ <protobuf-java_version>3.25.1</protobuf-java_version>
+ <bouncycastle-bcprov_version>1.70</bouncycastle-bcprov_version>
+ <envoy_api_version>0.1.35</envoy_api_version>
</properties>
<dependencyManagement>
@@ -158,7 +163,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-core-spi</artifactId>
@@ -204,6 +215,14 @@
</exclusions>
</dependency>
+ <!-- Test lib -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
@@ -514,6 +533,54 @@
</exclusion>
</exclusions>
</dependency>
+ <!-- for dubbo-rpc-rest-->
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jdk-http</artifactId>
+ <version>${resteasy_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jackson-provider</artifactId>
+ <version>${resteasy_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>${codehaus-jackson_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>${codehaus-jackson_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-jaxrs</artifactId>
+ <version>${codehaus-jackson_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-xc</artifactId>
+ <version>${codehaus-jackson_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ <version>${resteasy_version}</version>
+ </dependency>
+ <!-- swagger -->
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jaxrs</artifactId>
+ <version>${swagger_version}</version>
+ </dependency>
+
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>polaris-adapter-dubbo</artifactId>
@@ -539,6 +606,46 @@
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml_version}</version>
</dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>${protobuf-java_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ <version>${protobuf-java_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ <version>${bouncycastle-bcprov_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ <version>${bouncycastle-bcprov_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-ext-jdk15on</artifactId>
+ <version>${bouncycastle-bcprov_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.envoyproxy.controlplane</groupId>
+ <artifactId>api</artifactId>
+ <version>${envoy_api_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo.extensions</groupId>
+ <artifactId>dubbo-api-docs-annotations</artifactId>
+ <version>${revision}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo.extensions</groupId>
+ <artifactId>dubbo-api-docs-core</artifactId>
+ <version>${revision}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git
a/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/DNSServiceDiscovery.java
b/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/DNSServiceDiscovery.java
index 3c26786..72224ba 100644
---
a/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/DNSServiceDiscovery.java
+++
b/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/DNSServiceDiscovery.java
@@ -42,6 +42,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
public class DNSServiceDiscovery extends ReflectionBasedServiceDiscovery {
+
private static final Logger logger =
LoggerFactory.getLogger(DNSServiceDiscovery.class);
/**
@@ -111,7 +112,13 @@ public class DNSServiceDiscovery extends
ReflectionBasedServiceDiscovery {
public void
addServiceInstancesChangedListener(ServiceInstancesChangedListener listener)
throws NullPointerException, IllegalArgumentException {
listener.getServiceNames().forEach(serviceName -> {
ScheduledFuture<?> scheduledFuture =
pollingExecutorService.scheduleAtFixedRate(() -> {
- List<ServiceInstance> instances =
getInstances(serviceName);
+ List<ServiceInstance> instances;
+ try {
+ instances = getInstances(serviceName);
+ } catch (Throwable throwable) {
+ logger.error("Failed to get instances for " +
serviceName, throwable);
+ return;
+ }
instances.sort(Comparator.comparingInt(ServiceInstance::hashCode));
notifyListener(serviceName, listener, instances);
},
@@ -133,7 +140,7 @@ public class DNSServiceDiscovery extends
ReflectionBasedServiceDiscovery {
int port;
- if (resolveResult.getPort().size() > 0) {
+ if (!resolveResult.getPort().isEmpty()) {
// use first as default
port = resolveResult.getPort().get(0);
} else {
diff --git
a/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/util/DNSResolver.java
b/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/util/DNSResolver.java
index eb520d2..0bbd866 100644
---
a/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/util/DNSResolver.java
+++
b/dubbo-registry-extensions/dubbo-registry-dns/src/main/java/org/apache/dubbo/registry/dns/util/DNSResolver.java
@@ -81,6 +81,7 @@ public class DNSResolver {
// Port
int port = buf.readUnsignedShort();
recordList.getPort().add(port);
+ buf.release();
}
} catch (InterruptedException e) {
diff --git
a/dubbo-registry-extensions/dubbo-registry-dns/src/test/java/org/apache/dubbo/registry/dns/util/DNSResolverTest.java
b/dubbo-registry-extensions/dubbo-registry-dns/src/test/java/org/apache/dubbo/registry/dns/DNSResolverTest.java
similarity index 77%
rename from
dubbo-registry-extensions/dubbo-registry-dns/src/test/java/org/apache/dubbo/registry/dns/util/DNSResolverTest.java
rename to
dubbo-registry-extensions/dubbo-registry-dns/src/test/java/org/apache/dubbo/registry/dns/DNSResolverTest.java
index 17088ac..d3911a4 100644
---
a/dubbo-registry-extensions/dubbo-registry-dns/src/test/java/org/apache/dubbo/registry/dns/util/DNSResolverTest.java
+++
b/dubbo-registry-extensions/dubbo-registry-dns/src/test/java/org/apache/dubbo/registry/dns/DNSResolverTest.java
@@ -14,8 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.registry.dns.util;
+package org.apache.dubbo.registry.dns;
+import org.apache.dubbo.registry.dns.util.DNSResolver;
+import org.apache.dubbo.registry.dns.util.ResolveResult;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -24,7 +26,7 @@ public class DNSResolverTest {
@Test
public void testResolve() {
DNSResolver dnsResolver = new DNSResolver("8.8.8.8", 53, 1);
- ResolveResult resolve = dnsResolver.resolve("aliyun.com");
- Assertions.assertTrue(resolve.getHostnameList().size() > 0);
+ ResolveResult resolve = dnsResolver.resolve("dubbo.apache.org");
+ Assertions.assertFalse(resolve.getHostnameList().isEmpty());
}
}
diff --git
a/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/ClusterRedisClient.java
b/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/ClusterRedisClient.java
index fb5f4ff..87c48ee 100644
---
a/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/ClusterRedisClient.java
+++
b/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/ClusterRedisClient.java
@@ -75,7 +75,10 @@ public class ClusterRedisClient extends AbstractRedisClient
implements RedisClie
for (JedisPool jedisPool : poolMap.values()) {
Jedis jedis = jedisPool.getResource();
if (jedis.isConnected()) {
+ jedisPool.returnResource(jedis);
return true;
+ } else {
+ jedisPool.returnResource(jedis);
}
}
return false;
@@ -98,7 +101,7 @@ public class ClusterRedisClient extends AbstractRedisClient
implements RedisClie
for (JedisPool jedisPool : nodes.values()) {
Jedis jedis = jedisPool.getResource();
result.addAll(scan(jedis, pattern));
- jedis.close();
+ jedisPool.returnResource(jedis);
}
return result;
}
diff --git
a/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/MonoRedisClient.java
b/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/MonoRedisClient.java
index 07cb9ed..64e4ebb 100644
---
a/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/MonoRedisClient.java
+++
b/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/MonoRedisClient.java
@@ -55,7 +55,7 @@ public class MonoRedisClient extends AbstractRedisClient
implements RedisClient
public Long publish(String channel, String message) {
Jedis jedis = jedisPool.getResource();
Long result = jedis.publish(channel, message);
- jedis.close();
+ jedisPool.returnResource(jedis);
return result;
}
@@ -63,7 +63,7 @@ public class MonoRedisClient extends AbstractRedisClient
implements RedisClient
public boolean isConnected() {
Jedis jedis = jedisPool.getResource();
boolean connected = jedis.isConnected();
- jedis.close();
+ jedisPool.returnResource(jedis);
return connected;
}
@@ -76,7 +76,7 @@ public class MonoRedisClient extends AbstractRedisClient
implements RedisClient
public Long hdel(String key, String... fields) {
Jedis jedis = jedisPool.getResource();
Long result = jedis.hdel(key, fields);
- jedis.close();
+ jedisPool.returnResource(jedis);
return result;
}
@@ -84,7 +84,7 @@ public class MonoRedisClient extends AbstractRedisClient
implements RedisClient
public Set<String> scan(String pattern) {
Jedis jedis = jedisPool.getResource();
Set<String> result = super.scan(jedis, pattern);
- jedis.close();
+ jedisPool.returnResource(jedis);
return result;
}
@@ -92,7 +92,7 @@ public class MonoRedisClient extends AbstractRedisClient
implements RedisClient
public Map<String, String> hgetAll(String key) {
Jedis jedis = jedisPool.getResource();
Map<String, String> result = jedis.hgetAll(key);
- jedis.close();
+ jedisPool.returnResource(jedis);
return result;
}
diff --git
a/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/SentinelRedisClient.java
b/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/SentinelRedisClient.java
index 137a379..3fb4afa 100644
---
a/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/SentinelRedisClient.java
+++
b/dubbo-remoting-extensions/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/SentinelRedisClient.java
@@ -58,7 +58,7 @@ public class SentinelRedisClient extends AbstractRedisClient
implements RedisCli
public Long hset(String key, String field, String value) {
Jedis jedis = sentinelPool.getResource();
Long result = jedis.hset(key, field, value);
- jedis.close();
+ sentinelPool.returnResource(jedis);
return result;
}
@@ -66,7 +66,7 @@ public class SentinelRedisClient extends AbstractRedisClient
implements RedisCli
public Long publish(String channel, String message) {
Jedis jedis = sentinelPool.getResource();
Long result = jedis.publish(channel, message);
- jedis.close();
+ sentinelPool.returnResource(jedis);
return result;
}
@@ -74,7 +74,7 @@ public class SentinelRedisClient extends AbstractRedisClient
implements RedisCli
public boolean isConnected() {
Jedis jedis = sentinelPool.getResource();
boolean result = jedis.isConnected();
- jedis.close();
+ sentinelPool.returnResource(jedis);
return result;
}
@@ -87,7 +87,7 @@ public class SentinelRedisClient extends AbstractRedisClient
implements RedisCli
public Long hdel(String key, String... fields) {
Jedis jedis = sentinelPool.getResource();
Long result = jedis.hdel(key, fields);
- jedis.close();
+ sentinelPool.returnResource(jedis);
return result;
}
@@ -95,7 +95,7 @@ public class SentinelRedisClient extends AbstractRedisClient
implements RedisCli
public Set<String> scan(String pattern) {
Jedis jedis = sentinelPool.getResource();
Set<String> result = scan(jedis, pattern);
- jedis.close();
+ sentinelPool.returnResource(jedis);
return result;
}
@@ -103,7 +103,7 @@ public class SentinelRedisClient extends
AbstractRedisClient implements RedisCli
public Map<String, String> hgetAll(String key) {
Jedis jedis = sentinelPool.getResource();
Map<String, String> result = jedis.hgetAll(key);
- jedis.close();
+ sentinelPool.returnResource(jedis);
return result;
}
@@ -111,7 +111,7 @@ public class SentinelRedisClient extends
AbstractRedisClient implements RedisCli
public void psubscribe(JedisPubSub jedisPubSub, String... patterns) {
Jedis jedis = sentinelPool.getResource();
jedis.psubscribe(jedisPubSub, patterns);
- jedis.close();
+ sentinelPool.returnResource(jedis);
}
@Override
diff --git
a/dubbo-serialization-extensions/dubbo-serialization-protobuf/pom.xml
b/dubbo-serialization-extensions/dubbo-serialization-protobuf/pom.xml
index 9b575b4..8a40019 100644
--- a/dubbo-serialization-extensions/dubbo-serialization-protobuf/pom.xml
+++ b/dubbo-serialization-extensions/dubbo-serialization-protobuf/pom.xml
@@ -37,15 +37,18 @@ limitations under the License.
<artifactId>dubbo-serialization-api</artifactId>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
- <version>3.16.3</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
- <version>3.11.0</version>
</dependency>
</dependencies>
diff --git
a/dubbo-serialization-extensions/dubbo-serialization-protobuf/src/main/java/org/apache/dubbo/common/serialize/protobuf/support/ProtobufParamDeepCopyUtil.java
b/dubbo-serialization-extensions/dubbo-serialization-protobuf/src/main/java/org/apache/dubbo/common/serialize/protobuf/support/ProtobufParamDeepCopyUtil.java
new file mode 100644
index 0000000..b3a5fdf
--- /dev/null
+++
b/dubbo-serialization-extensions/dubbo-serialization-protobuf/src/main/java/org/apache/dubbo/common/serialize/protobuf/support/ProtobufParamDeepCopyUtil.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.common.serialize.protobuf.support;
+
+import static
org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_ERROR_DESERIALIZE;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.rpc.protocol.injvm.DefaultParamDeepCopyUtil;
+import org.apache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil;
+
+public class ProtobufParamDeepCopyUtil implements ParamDeepCopyUtil {
+ private static final ErrorTypeAwareLogger logger =
LoggerFactory.getErrorTypeAwareLogger(DefaultParamDeepCopyUtil.class);
+
+ private ParamDeepCopyUtil delegate;
+
+ public ProtobufParamDeepCopyUtil(ParamDeepCopyUtil delegate) {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public <T> T copy(URL url, Object src, Class<T> targetClass) {
+ boolean isProtobufTypeSupported =
ProtobufUtils.isSupported(targetClass);
+ if(isProtobufTypeSupported){
+ try (ByteArrayOutputStream outputStream = new
ByteArrayOutputStream()) {
+ ProtobufUtils.serialize(src, outputStream);
+
+ try (ByteArrayInputStream inputStream = new
ByteArrayInputStream(outputStream.toByteArray())) {
+ T deserialize = ProtobufUtils.deserialize(inputStream,
targetClass);
+ return deserialize;
+ } catch (IOException e) {
+ logger.error(PROTOCOL_ERROR_DESERIALIZE, "", "", "Unable
to deep copy parameter to target class.", e);
+ }
+
+ } catch (Throwable e) {
+ logger.error(PROTOCOL_ERROR_DESERIALIZE, "", "", "Unable to
deep copy parameter to target class.", e);
+ }
+
+ if (src.getClass().equals(targetClass)) {
+ return (T) src;
+ } else {
+ return null;
+ }
+ }
+ return delegate.copy(url, src, targetClass);
+ }
+}
diff --git
a/dubbo-serialization-extensions/dubbo-serialization-protobuf/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil
b/dubbo-serialization-extensions/dubbo-serialization-protobuf/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil
new file mode 100644
index 0000000..a3cb3e6
--- /dev/null
+++
b/dubbo-serialization-extensions/dubbo-serialization-protobuf/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil
@@ -0,0 +1 @@
+protobufDeepUtil=org.apache.dubbo.common.serialize.protobuf.support.ProtobufParamDeepCopyUtil
diff --git
a/dubbo-serialization-extensions/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protobuf/support/ProtobufParamDeepCopyUtilTest.java
b/dubbo-serialization-extensions/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protobuf/support/ProtobufParamDeepCopyUtilTest.java
new file mode 100644
index 0000000..1c4db2e
--- /dev/null
+++
b/dubbo-serialization-extensions/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protobuf/support/ProtobufParamDeepCopyUtilTest.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.common.serialize.protobuf.support;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.common.serialize.protobuf.support.model.GooglePB;
+import org.apache.dubbo.rpc.protocol.injvm.DefaultParamDeepCopyUtil;
+import org.apache.dubbo.rpc.protocol.injvm.ParamDeepCopyUtil;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+
+public class ProtobufParamDeepCopyUtilTest {
+ private ParamDeepCopyUtil paramDeepCopyUtil;
+
+ @BeforeEach
+ public void setUp() {
+ URL url = mockURL();
+ this.paramDeepCopyUtil =
url.getOrDefaultFrameworkModel().getExtensionLoader(ParamDeepCopyUtil.class)
+
.getExtension(url.getParameter(CommonConstants.INJVM_COPY_UTIL_KEY,
DefaultParamDeepCopyUtil.NAME));
+ }
+
+ @Test
+ public void testProtobufDeepCopy() throws InvalidProtocolBufferException {
+ ProtobufUtils.marshaller(GooglePB.PBRequestType.getDefaultInstance());
+ GooglePB.PhoneNumber phoneNumber = GooglePB.PhoneNumber.newBuilder()
+ .setNumber("134123781291").build();
+ List<GooglePB.PhoneNumber> phoneNumberList = new ArrayList<>();
+ phoneNumberList.add(phoneNumber);
+ Map<String, GooglePB.PhoneNumber> phoneNumberMap = new HashMap<>();
+ phoneNumberMap.put("someUser", phoneNumber);
+ GooglePB.PBRequestType request = GooglePB.PBRequestType.newBuilder()
+ .setAge(15).setCash(10).setMoney(16.0).setNum(100L)
+
.addAllPhone(phoneNumberList).putAllDoubleMap(phoneNumberMap).build();
+ GooglePB.PBRequestType copyResult = paramDeepCopyUtil.copy(mockURL(),
request, GooglePB.PBRequestType.class);
+ String jsonString = ProtobufUtils.serializeJson(request);
+ String jsonString2 = ProtobufUtils.serializeJson(copyResult);
+ assertEquals(jsonString, jsonString2);
+ assertNotEquals(System.identityHashCode(request),
System.identityHashCode(copyResult));
+ List<GooglePB.PhoneNumber> copyPhoneList = copyResult.getPhoneList();
+ Map<String, GooglePB.PhoneNumber> copyDoubleMap =
copyResult.getDoubleMap();
+ assertNotEquals(System.identityHashCode(phoneNumberList.get(0)),
System.identityHashCode(copyPhoneList.get(0)));
+
assertNotEquals(System.identityHashCode(phoneNumberMap.get("someUser")),
System.identityHashCode(copyDoubleMap.get("someUser")));
+ }
+
+ URL mockURL() {
+ URL url = new URL("dubbo", "localhost", 20880);
+ return url;
+ }
+}
diff --git a/pom.xml b/pom.xml
index 36c3a12..376ffdf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,14 +102,16 @@
<properties>
<revision>3.1.0</revision>
<!-- Test libs -->
- <junit_jupiter_version>5.6.0</junit_jupiter_version>
+ <junit_jupiter_version>5.9.3</junit_jupiter_version>
+ <junit_platform_commons>1.9.3</junit_platform_commons>
+ <awaitility_version>4.2.1</awaitility_version>
<hazelcast_version>3.11.1</hazelcast_version>
<hamcrest_version>2.2</hamcrest_version>
<hibernate_validator_version>5.2.4.Final</hibernate_validator_version>
<el_api_version>2.2.4</el_api_version>
<jaxb_api_version>2.2.7</jaxb_api_version>
<cglib_version>2.2</cglib_version>
- <mockito_version>3.8.0</mockito_version>
+ <mockito_version>4.11.0</mockito_version>
<!-- for maven compiler plugin -->
<java_source_version>1.8</java_source_version>
<java_target_version>1.8</java_target_version>
@@ -171,6 +173,18 @@
<version>${junit_jupiter_version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-commons</artifactId>
+ <version>${junit_platform_commons}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit_jupiter_version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
@@ -183,12 +197,24 @@
<version>${hamcrest_version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <version>${awaitility_version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito_version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-inline</artifactId>
+ <version>${mockito_version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
@@ -355,11 +381,13 @@
<exclude>Jenkinsfile</exclude>
<exclude>**/codestyle/*</exclude>
<exclude>**/resources/META-INF/**</exclude>
+ <exclude>**/resources/security/**</exclude>
<exclude>.github/**</exclude>
<exclude>compiler/**</exclude>
<exclude>**/generated/**</exclude>
<!-- exclude mockito extensions spi files -->
<exclude>**/mockito-extensions/*</exclude>
+ <exclude>**/junit**</exclude>
</excludes>
</configuration>
</plugin>
@@ -560,9 +588,12 @@
<failOnViolation>true</failOnViolation>
<skip>${checkstyle.skip}</skip>
<excludes>
- **/istio/v1/auth/Ca.java,
-
**/istio/v1/auth/IstioCertificateServiceGrpc.java,
+ **/istio/v1/auth/**/*,
+ **/com/google/rpc/*,
**/generated/**/*,
+ **/generated-sources/**/*,
+ **/grpc/health/**/*,
+ **/grpc/reflection/**/*,
**/target/**/*,
</excludes>
</configuration>