diff --git a/.github/workflows/build-and-test-pr.yml b/.github/workflows/build-and-test-pr.yml index fd2560825ab..1315b7f6b25 100644 --- a/.github/workflows/build-and-test-pr.yml +++ b/.github/workflows/build-and-test-pr.yml @@ -346,9 +346,9 @@ jobs: path: target/jacoco*.exec - name: "Upload test result" if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: samples-test-result + name: samples-test-result-${{matrix.job_id}} path: test/jobs/*-result* samples-test-result: needs: [check-format, samples-test-job] @@ -362,9 +362,9 @@ jobs: repository: 'apache/dubbo-samples' ref: master - name: "Download test result" - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: samples-test-result + pattern: samples-test-result-* path: test/jobs/ - name: "Merge test result" run: ./test/scripts/merge-test-results.sh @@ -449,9 +449,9 @@ jobs: path: target/jacoco*.exec - name: "Upload test result" if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: test-result + name: test-result-${{matrix.job_id}} path: test/jobs/*-result* integration-test-result: needs: [check-format, integration-test-job] @@ -465,9 +465,9 @@ jobs: repository: 'apache/dubbo-integration-cases' ref: main - name: "Download test result" - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: test-result + pattern: test-result-* path: test/jobs/ - name: "Merge test result" run: ./test/scripts/merge-test-results.sh diff --git a/.github/workflows/build-and-test-scheduled-3.1.yml b/.github/workflows/build-and-test-scheduled-3.1.yml index e237f428a87..1762f641bcd 100644 --- a/.github/workflows/build-and-test-scheduled-3.1.yml +++ b/.github/workflows/build-and-test-scheduled-3.1.yml @@ -297,7 +297,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: samples-test-result-${{matrix.job_id}} + name: samples-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* samples-test-result: needs: [samples-test-job] @@ -316,7 +316,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: samples-test-result-* + pattern: samples-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" @@ -396,7 +396,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: integration-test-result-${{matrix.job_id}} + name: integration-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* integration-test-result: needs: [integration-test-job] @@ -415,7 +415,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: integration-test-result-* + pattern: integration-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" diff --git a/.github/workflows/build-and-test-scheduled-3.2.yml b/.github/workflows/build-and-test-scheduled-3.2.yml index 370ce6d3b00..f084e55c8b7 100644 --- a/.github/workflows/build-and-test-scheduled-3.2.yml +++ b/.github/workflows/build-and-test-scheduled-3.2.yml @@ -297,7 +297,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: samples-test-result-${{matrix.job_id}} + name: samples-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* samples-test-result: needs: [samples-test-job] @@ -316,7 +316,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: samples-test-result-* + pattern: samples-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" @@ -396,7 +396,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: integration-test-result-${{matrix.job_id}} + name: integration-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* integration-test-result: needs: [integration-test-job] @@ -415,7 +415,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: integration-test-result-* + pattern: integration-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" diff --git a/.github/workflows/build-and-test-scheduled-3.3.yml b/.github/workflows/build-and-test-scheduled-3.3.yml index 76fc28eeb4b..fed0d6dc15b 100644 --- a/.github/workflows/build-and-test-scheduled-3.3.yml +++ b/.github/workflows/build-and-test-scheduled-3.3.yml @@ -297,7 +297,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: samples-test-result-${{matrix.job_id}} + name: samples-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* samples-test-result: needs: [samples-test-job] @@ -316,7 +316,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: samples-test-result-* + pattern: samples-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" @@ -396,7 +396,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: integration-test-result-${{matrix.job_id}} + name: integration-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* integration-test-result: needs: [integration-test-job] @@ -415,7 +415,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: integration-test-result-* + pattern: integration-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index 4895593e9a7..1a1584d466f 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -294,7 +294,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: samples-test-result-${{matrix.job_id}} + name: samples-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* samples-test-result: needs: [samples-test-job] @@ -313,7 +313,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: samples-test-result-* + pattern: samples-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" @@ -393,7 +393,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: integration-test-result-${{matrix.job_id}} + name: integration-test-result-${{matrix.jdk}}-${{matrix.job_id}} path: test/jobs/*-result* integration-test-result: needs: [integration-test-job] @@ -412,7 +412,7 @@ jobs: - name: "Download test result" uses: actions/download-artifact@v4 with: - name: integration-test-result-* + pattern: integration-test-result-${{matrix.jdk}}-* github-token: ${{ secrets.GITHUB_TOKEN }} path: test/jobs/ - name: "Merge test result" diff --git a/README.md b/README.md index 6b371e8b3b1..8adc0043cb0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Percentage of issues still open](http://isitmaintained.com/badge/open/apache/dubbo.svg)](http://isitmaintained.com/project/apache/dubbo "Percentage of issues still open") Apache Dubbo is an easy-to-use Web and RPC framework that provides multiple -language implementations(Java, [Go](https://github.com/apache/dubbo-go), [Rust](https://github.com/apache/dubbo-rust), [Node.js](https://github.com/apache/dubbo-js), [Web](https://github.com/apache/dubbo-js)) for communication, service discovery, traffic management, +language implementations(Java, [Go](https://github.com/apache/dubbo-go), [Python](https://github.com/dubbo/py-client-for-apache-dubbo), [PHP](https://github.com/apache/dubbo-php-framework), [Erlang](https://github.com/apache/dubbo-erlang), [Rust](https://github.com/apache/dubbo-rust), [Node.js](https://github.com/apache/dubbo-js), [Web](https://github.com/apache/dubbo-js)) for communication, service discovery, traffic management, observability, security, tools, and best practices for building enterprise-ready microservices. We are now collecting Dubbo user info to help us to improve Dubbo further. Kindly support us by providing your usage information on [Wanted: who's using dubbo](https://github.com/apache/dubbo/discussions/13842), thanks :) @@ -24,13 +24,13 @@ We are now collecting Dubbo user info to help us to improve Dubbo further. Kindl Follow the instructions below to learn how to: ### Programming with lightweight RPC API -[5 minutes step-by-step guide](https://dubbo.apache.org/zh-cn/overview/quickstart/rpc/java) +[5 minutes step-by-step guide](https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/tasks/framework/lightweight-rpc/) -Dubbo supports building RPC services with only a few lines of code while depending only on a lightweight SDK (<10MB). The protocol on the wire can be [Triple](https://dubbo.apache.org/zh-cn/overview/reference/protocols/triple/)(fully gRPC compatible and HTTP-friendly), Dubbo2(TCP), REST, or any protocol of your choice. +Dubbo supports building RPC services with only a few lines of code while depending only on a lightweight SDK. The protocol on the wire can be [Triple](https://dubbo.apache.org/zh-cn/overview/reference/protocols/triple/)(fully gRPC compatible and HTTP-friendly), Dubbo2(TCP), REST, or any protocol of your choice. ### Building a microservice application with Spring Boot -[5 minutes step-by-step guide](https://dubbo.apache.org/zh-cn/overview/quickstart/microservice) +[5 minutes step-by-step guide](https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/tasks/develop/springboot/) It's highly recommended to start your microservice application with the Spring Boot Starter `dubbo-spring-boot-starter` provided by Dubbo. With only a single dependency and yaml file, and optionally a bunch of other useful spring boot starters, you can enable all of the Dubo features like service discovery, observability, tracing, etc. @@ -50,11 +50,11 @@ Get more details by visiting the links below to get your hands dirty with some w * [Kubernetes and Service mesh](https://dubbo.apache.org/zh-cn/overview/core-features/service-mesh/) ## Which Dubbo version should I use? -| **Dubbo3** | **JDK** | **Dependencies** | **Description** | -| --- | --- | --- | --- | -| 3.3.0-beta| 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/3.3/dubbo-dependencies-bom/pom.xml#L94) | **- Unstable version**
**- Features**
   - Triple - gRPC and cURL compatible.
   - Rest-style programming support.
   - Spring Boot Starters. | -| 3.2.5 | 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.5/dubbo-dependencies-bom/pom.xml#L94) | **- Stable version (active)**
**- Features**
  - Out-of-box metrics and tracing support.
  - Threadpool Isolation
  - 30% performance
  - Native Image| -| 3.1.11 | 1.8 ~ 11 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.11/dubbo-dependencies-bom/pom.xml#L94) | **Stable version (not active)** | +| **Dubbo3** | **JDK** | **Dependencies** | **Description** | +|------------|----------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 3.3.2 | 1.8 ~ 21 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.3.2/dubbo-dependencies-bom/pom.xml#L92) | **- Stable version (active)**
**- Features**
   - Triple - gRPC and cURL compatible.
   - Rest-style programming support.
   - Spring Boot Starters. | +| 3.2.16 | 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.5/dubbo-dependencies-bom/pom.xml#L94) | **- Stable version (active)**
**- Features**
  - Out-of-box metrics and tracing support.
  - Threadpool Isolation
  - 30% performance
  - Native Image | +| 3.1.11 | 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.11/dubbo-dependencies-bom/pom.xml#L90) | **Stable version (not active)** | | **Dubbo2** | **JDK** | **Dependencies** | **Description** | | --- | --- | --- | --- | @@ -76,7 +76,7 @@ We have also implemented [a project board](https://github.com/orgs/apache/projec Any essential changes should be discussed on the mailing list before they happen. -### Seeking for help +### Seeking help If you have questions such as: @@ -96,7 +96,7 @@ Please open an issue at https://github.com/apache/dubbo/issues. To ask effective questions, we recommend reading **[How To Ask Questions The Smart Way](https://github.com/selfteaching/How-To-Ask-Questions-The-Smart-Way/blob/master/How-To-Ask-Questions-The-Smart-Way.md)** first. -### Contribution +### Make a Contribution - Browse the "help wanted" tasks in the [Dubbo project board](https://github.com/orgs/apache/projects/337). - Participate in discussions on the mailing list. See the subscription [guide](https://github.com/apache/dubbo/wiki/Mailing-list-subscription-guide). @@ -112,7 +112,7 @@ To ask effective questions, we recommend reading **[How To Ask Questions The Sma - Any other forms of contribution not listed above are also welcome. - If you're interested in contributing, please send an email to [dev@dubbo.apache.org](mailto:dev@dubbo.apache.org) to let us know! -For further details, please refer our [guide](https://github.com/apache/dubbo/blob/master/CONTRIBUTING.md) about how to contribute Dubbo. +For more details, please take a look at our [guide](https://github.com/apache/dubbo/blob/master/CONTRIBUTING.md) about how to contribute to Dubbo. ## Reporting bugs @@ -129,50 +129,5 @@ Please report security vulnerabilities to [us](mailto:security@dubbo.apache.org) * Twitter: [@ApacheDubbo](https://twitter.com/ApacheDubbo) * Security issues: please mail to [us](mailto:security@dubbo.apache.org) privately. -## Contributing - -See [CONTRIBUTING](https://github.com/apache/dubbo/blob/master/CONTRIBUTING.md) for details on submitting patches and the contribution workflow. - -### How can I contribute? - -* Take a look at issues with tags marked [`Good first issue`](https://github.com/apache/dubbo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) or [`Help wanted`](https://github.com/apache/dubbo/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). -* Join the discussion on the mailing list, subscription [guide](https://github.com/apache/dubbo/wiki/Mailing-list-subscription-guide). -* Answer questions on [issues](https://github.com/apache/dubbo/issues). -* Fix bugs reported on [issues](https://github.com/apache/dubbo/issues), and send us a pull request. -* Review the existing [pull request](https://github.com/apache/dubbo/pulls). -* Improve the [website](https://github.com/apache/dubbo-website), typically we need - * blog post - * translation on documentation - * use cases around the integration of Dubbo in enterprise systems. -* Improve the [dubbo-admin/dubbo-monitor](https://github.com/apache/dubbo-admin). -* Contribute to the projects listed in [ecosystem](https://github.com/dubbo). -* Other forms of contribution not explicitly enumerated above. -* If you would like to contribute, please send an email to dev@dubbo.apache.org to let us know! - -## Reporting bugs - -Please follow the [template](https://github.com/apache/dubbo/issues/new?template=dubbo-issue-report-template.md) for reporting any issues. - -## Reporting a security vulnerability - -Please report security vulnerabilities to [us](mailto:security@dubbo.apache.org) privately. - -## Dubbo ecosystem - -* [Dubbo Ecosystem Entry](https://github.com/apache?utf8=%E2%9C%93&q=dubbo&type=&language=) - A GitHub group `dubbo` to gather all Dubbo relevant projects not appropriate in [apache](https://github.com/apache) group yet -* [Dubbo Website](https://github.com/apache/dubbo-website) - Apache Dubbo official website -* [Dubbo Samples](https://github.com/apache/dubbo-samples) - samples for Apache Dubbo -* [Dubbo Admin](https://github.com/apache/dubbo-admin) - The reference implementation for Dubbo admin -* [Dubbo Awesome](https://github.com/apache/dubbo-awesome) - Dubbo's slides and video links in Meetup - -#### Language - -* [Go](https://github.com/apache/dubbo-go) (recommended) -* [Rust](https://github.com/apache/dubbo-rust) -* [Node.js](https://github.com/apache/dubbo-js) -* [Python](https://github.com/dubbo/py-client-for-apache-dubbo) -* [PHP](https://github.com/apache/dubbo-php-framework) -* [Erlang](https://github.com/apache/dubbo-erlang) - ## License -Apache Dubbo is licensed under the Apache License Version 2.0. See the [LICENSE](https://github.com/apache/dubbo/blob/master/LICENSE) file for details. +Apache Dubbo is licensed under the Apache License Version 2.0. See the [LICENSE](https://github.com/apache/dubbo/blob/3.3/LICENSE) file for details. diff --git a/dubbo-cluster/pom.xml b/dubbo-cluster/pom.xml index 3a0e67b62a6..be9f9477c7a 100644 --- a/dubbo-cluster/pom.xml +++ b/dubbo-cluster/pom.xml @@ -29,7 +29,7 @@ The cluster module of dubbo project false - 15.4 + 15.6 diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java index f201bbf7dbf..ded784724a3 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java @@ -102,7 +102,7 @@ void testSelectByWeight() { @Test void testNodeCacheShouldNotRecycle() { int loop = 10000; - // tmperately add a new invoker + // temperately add a new invoker weightInvokers.add(weightInvokerTmp); try { Map resultMap = getWeightedInvokeResult(loop, RoundRobinLoadBalance.NAME); @@ -143,7 +143,7 @@ void testNodeCacheShouldRecycle() { } int loop = 10000; - // tmperately add a new invoker + // temperately add a new invoker weightInvokers.add(weightInvokerTmp); try { Map resultMap = getWeightedInvokeResult(loop, RoundRobinLoadBalance.NAME); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java index 8d414b648ba..50cc0a830cf 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java @@ -738,6 +738,15 @@ interface DubboProperty { */ String DUBBO_PREFERRED_NETWORK_INTERFACE = "dubbo.network.interface.preferred"; + /** + * The property name for {@link NetworkInterface#isPointToPoint() return whether a network interface is a point + * to point interface} that the Dubbo application will determine whether to ignore the point-to-point network + * interface + * + * @since 3.3 + */ + String DUBBO_NETWORK_INTERFACE_POINT_TO_POINT_IGNORED = "dubbo.network.interface.point-to-point.ignored"; + String DUBBO_CLASS_DESERIALIZE_ALLOWED_LIST = "dubbo.security.serialize.allowedClassList"; String DUBBO_CLASS_DESERIALIZE_BLOCKED_LIST = "dubbo.security.serialize.blockedClassList"; String DUBBO_CLASS_DESERIALIZE_OPEN_CHECK = "dubbo.security.serialize.openCheckClass"; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java index d53c36a73cd..9a8689319cc 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java @@ -451,6 +451,11 @@ private static boolean ignoreNetworkInterface(NetworkInterface networkInterface) || !networkInterface.isUp()) { return true; } + if (Boolean.parseBoolean(SystemPropertyConfigUtils.getSystemProperty( + CommonConstants.DubboProperty.DUBBO_NETWORK_INTERFACE_POINT_TO_POINT_IGNORED, "false")) + && networkInterface.isPointToPoint()) { + return true; + } String ignoredInterfaces = SystemPropertyConfigUtils.getSystemProperty( CommonConstants.DubboProperty.DUBBO_NETWORK_IGNORED_INTERFACE); String networkInterfaceDisplayName; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/MethodDescriptor.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/MethodDescriptor.java index 2496d2dea31..77f87ede4ae 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/MethodDescriptor.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/MethodDescriptor.java @@ -51,6 +51,10 @@ public interface MethodDescriptor { Object getAttribute(String key); + Class[] getActualRequestTypes(); + + Class getActualResponseType(); + enum RpcType { UNARY, CLIENT_STREAM, diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptor.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptor.java index 6bb9ddcb330..ac0778d601a 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptor.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptor.java @@ -22,8 +22,10 @@ import org.apache.dubbo.common.utils.ReflectUtils; import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Arrays; +import java.util.Collections; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -48,6 +50,8 @@ public class ReflectionMethodDescriptor implements MethodDescriptor { private final Method method; private final boolean generic; private final RpcType rpcType; + private Class[] actualRequestTypes; + private Class actualResponseType; public ReflectionMethodDescriptor(Method method) { this.method = method; @@ -82,13 +86,30 @@ private RpcType determineRpcType() { if (parameterClasses.length > 2) { return RpcType.UNARY; } + Type[] genericParameterTypes = method.getGenericParameterTypes(); if (parameterClasses.length == 1 && isStreamType(parameterClasses[0]) && isStreamType(returnClass)) { + this.actualRequestTypes = new Class[] { + obtainActualTypeInStreamObserver( + ((ParameterizedType) method.getGenericReturnType()).getActualTypeArguments()[0]) + }; + actualResponseType = obtainActualTypeInStreamObserver( + ((ParameterizedType) genericParameterTypes[0]).getActualTypeArguments()[0]); return RpcType.BI_STREAM; } - if (parameterClasses.length == 2 + boolean returnIsVoid = returnClass.getName().equals(void.class.getName()); + if (returnIsVoid && parameterClasses.length == 1 && isStreamType(parameterClasses[0])) { + actualRequestTypes = Collections.emptyList().toArray(new Class[0]); + actualResponseType = obtainActualTypeInStreamObserver( + ((ParameterizedType) method.getGenericParameterTypes()[0]).getActualTypeArguments()[0]); + return RpcType.SERVER_STREAM; + } + if (returnIsVoid + && parameterClasses.length == 2 && !isStreamType(parameterClasses[0]) - && isStreamType(parameterClasses[1]) - && returnClass.getName().equals(void.class.getName())) { + && isStreamType(parameterClasses[1])) { + actualRequestTypes = parameterClasses; + actualResponseType = obtainActualTypeInStreamObserver( + ((ParameterizedType) method.getGenericParameterTypes()[1]).getActualTypeArguments()[0]); return RpcType.SERVER_STREAM; } if (Arrays.stream(parameterClasses).anyMatch(this::isStreamType) || isStreamType(returnClass)) { @@ -156,6 +177,23 @@ public Object getAttribute(String key) { return this.attributeMap.get(key); } + @Override + public Class[] getActualRequestTypes() { + return actualRequestTypes; + } + + @Override + public Class getActualResponseType() { + return actualResponseType; + } + + private Class obtainActualTypeInStreamObserver(Type typeInStreamObserver) { + return (Class) + (typeInStreamObserver instanceof ParameterizedType + ? ((ParameterizedType) typeInStreamObserver).getRawType() + : typeInStreamObserver); + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java index 784c93e12bc..2e0c3f84a7e 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java @@ -119,6 +119,16 @@ public Object getAttribute(String key) { return this.attributeMap.get(key); } + @Override + public Class[] getActualRequestTypes() { + return this.parameterClasses; + } + + @Override + public Class getActualResponseType() { + return this.returnClass; + } + @Override public Pack getRequestPack() { return requestPack; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java index 6cb0be0f36f..107d66cdf62 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -72,7 +73,7 @@ void testExtendLengthForBuffer() throws IOException { @Test void testToStringWithCharset() throws IOException { UnsafeByteArrayOutputStream outputStream = new UnsafeByteArrayOutputStream(); - outputStream.write("Hòa Bình".getBytes()); + outputStream.write("Hòa Bình".getBytes(StandardCharsets.UTF_8)); assertThat(outputStream.toString("UTF-8"), is("Hòa Bình")); } diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java index 28a8cb7fff4..4916a74bd94 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java @@ -29,6 +29,8 @@ import org.hamcrest.Matchers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; @@ -74,6 +76,7 @@ void testObjectInput() throws IOException { } @Test + @DisabledOnOs(OS.WINDOWS) // Charset maynot UTF-8 on Windows JDK 8 ~ 17 void testWriteUTF() throws IOException { myObjectOutput.writeUTF("Pace"); myObjectOutput.writeUTF("和平"); diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java index 913785a9c50..338962817df 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java @@ -883,7 +883,7 @@ private void postProcessConfig() { /** * Return if ReferenceConfig has been initialized - * Note: Cannot use `isInitilized` as it may be treated as a Java Bean property + * Note: Cannot use `isInitialized` as it may be treated as a Java Bean property * * @return initialized */ diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilder.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilder.java index 1d43765bfd7..ee0b529d0c1 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilder.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilder.java @@ -53,7 +53,7 @@ public abstract class AbstractInterfaceBuilder< protected MonitorConfig monitor; /** - * Strategies for generating dynamic agents,there are two strategies can be choosed: jdk and javassist + * Strategies for generating dynamic agents,there are two strategies can be chosen: jdk and javassist */ protected String proxy; diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java index 92b3baeebbd..964ed9c777a 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java @@ -31,7 +31,7 @@ /** * The test-case for https://github.com/apache/dubbo/issues/6000 - * Autowired a ReferenceBean failed in some situation in Spring enviroment + * Autowired a ReferenceBean failed in some situation in Spring environment */ @Configuration @EnableDubbo diff --git a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/ApiConsumer.java b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/ApiConsumer.java index a16fdd07229..d4519a3c1a5 100644 --- a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/ApiConsumer.java +++ b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/ApiConsumer.java @@ -73,6 +73,25 @@ public void onCompleted() { System.out.println("Call sayHelloServerStream"); greeterService.sayHelloServerStream(buildRequest("triple"), responseObserver); + StreamObserver sayHelloServerStreamNoParameterResponseObserver = new StreamObserver() { + @Override + public void onNext(HelloReply reply) { + System.out.println("sayHelloServerStreamNoParameter onNext: " + reply.getMessage()); + } + + @Override + public void onError(Throwable t) { + System.out.println("sayHelloServerStreamNoParameter onError: " + t.getMessage()); + } + + @Override + public void onCompleted() { + System.out.println("sayHelloServerStreamNoParameter onCompleted"); + } + }; + + greeterService.sayHelloServerStreamNoParameter(sayHelloServerStreamNoParameterResponseObserver); + StreamObserver biResponseObserver = new StreamObserver() { @Override public void onNext(HelloReply reply) { diff --git a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterService.java b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterService.java index e777429e71d..1c3345ee0bd 100644 --- a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterService.java +++ b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterService.java @@ -37,6 +37,8 @@ public interface GreeterService { */ void sayHelloServerStream(HelloRequest request, StreamObserver responseObserver); + void sayHelloServerStreamNoParameter(StreamObserver responseObserver); + /** * Sends greetings with bi streaming */ diff --git a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterServiceImpl.java b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterServiceImpl.java index ef699dd69d7..8626e9aa836 100644 --- a/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterServiceImpl.java +++ b/dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet/src/main/java/org/apache/dubbo/springboot/demo/servlet/GreeterServiceImpl.java @@ -52,6 +52,17 @@ public void sayHelloServerStream(HelloRequest request, StreamObserver responseObserver) { + LOGGER.info("Received sayHelloServerStreamNoParameter request"); + for (int i = 1; i < 6; i++) { + LOGGER.info("sayHelloServerStreamNoParameter onNext: {} times", i); + responseObserver.onNext(toReply("Hello " + ' ' + i + " times")); + } + LOGGER.info("sayHelloServerStreamNoParameter onCompleted"); + responseObserver.onCompleted(); + } + @Override public StreamObserver sayHelloBiStream(StreamObserver responseObserver) { LOGGER.info("Received sayHelloBiStream request"); diff --git a/dubbo-demo/dubbo-demo-spring-boot/pom.xml b/dubbo-demo/dubbo-demo-spring-boot/pom.xml index 5edb4e6a3bf..cc33f691d06 100644 --- a/dubbo-demo/dubbo-demo-spring-boot/pom.xml +++ b/dubbo-demo/dubbo-demo-spring-boot/pom.xml @@ -39,7 +39,7 @@ true 2.7.18 2.7.18 - 1.14.1 + 1.14.2 diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 844a31daca6..f52b52ec8dc 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -93,9 +93,9 @@ 2.7.18 5.8.16 3.30.2-GA - 1.15.10 + 1.15.11 3.2.10.Final - 4.1.115.Final + 4.1.116.Final 0.0.28.Final 4.5.14 4.4.16 @@ -125,11 +125,11 @@ 1.13.6 1.45.0 3.4.3 - 1.4.0 + 1.4.1 3.3 0.16.0 1.0.4 - 3.7.0 + 3.7.1 2.2.21 3.14.9 @@ -140,7 +140,7 @@ 2.4.3 1.8.8 1.8.0 - 1.68.2 + 1.69.0 0.8.1 1.2.2 0.9.14 @@ -150,14 +150,14 @@ 1.2.17 1.2.13 - 2.24.2 + 2.24.3 2.18.0 1.17.1 4.0.24 - 5.11.3 - 1.11.3 + 5.11.4 + 1.11.4 4.2.2 2.2 2.2.2 diff --git a/dubbo-maven-plugin/pom.xml b/dubbo-maven-plugin/pom.xml index a25e21f04de..f4c842b3cec 100644 --- a/dubbo-maven-plugin/pom.xml +++ b/dubbo-maven-plugin/pom.xml @@ -51,7 +51,7 @@ org.codehaus.plexus plexus-utils - 3.5.1 + 3.6.0 diff --git a/dubbo-plugin/dubbo-rest-jaxrs/pom.xml b/dubbo-plugin/dubbo-rest-jaxrs/pom.xml index 4f9f31e70d5..8aaf240772d 100644 --- a/dubbo-plugin/dubbo-rest-jaxrs/pom.xml +++ b/dubbo-plugin/dubbo-rest-jaxrs/pom.xml @@ -120,7 +120,7 @@ org.apache.dubbo.extensions dubbo-rpc-rest - 3.3.0 + 3.3.1 test diff --git a/dubbo-plugin/dubbo-rest-openapi/pom.xml b/dubbo-plugin/dubbo-rest-openapi/pom.xml index f3199369f92..60ebc45eaba 100644 --- a/dubbo-plugin/dubbo-rest-openapi/pom.xml +++ b/dubbo-plugin/dubbo-rest-openapi/pom.xml @@ -27,10 +27,10 @@ dubbo-rest-openapi - 2.2.25 + 2.2.27 5.18.2 2.2.0 - 1.0.0 + 1.0.1 0.15.0 diff --git a/dubbo-plugin/dubbo-rest-spring/pom.xml b/dubbo-plugin/dubbo-rest-spring/pom.xml index 16619482aa1..6c9a0ef4257 100644 --- a/dubbo-plugin/dubbo-rest-spring/pom.xml +++ b/dubbo-plugin/dubbo-rest-spring/pom.xml @@ -129,7 +129,7 @@ org.apache.dubbo.extensions dubbo-rpc-rest - 3.3.0 + 3.3.1 test diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java index bdcbc4a9c92..d36c1d64a9f 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java @@ -29,6 +29,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -75,7 +76,7 @@ protected byte[] join(byte[] in1, byte[] in2) { protected byte[] objectToByte(Object obj) { byte[] bytes; if (obj instanceof String) { - bytes = ((String) obj).getBytes(); + bytes = ((String) obj).getBytes(StandardCharsets.UTF_8); } else if (obj instanceof byte[]) { bytes = (byte[]) obj; } else { @@ -246,7 +247,7 @@ void testDecode_Backspace() throws IOException { testDecode_assertEquals(new byte[] {'\b'}, Codec2.DecodeResult.NEED_MORE_INPUT, new String(new byte[] {32, 8})); // test chinese - byte[] chineseBytes = "中".getBytes(); + byte[] chineseBytes = "中".getBytes(StandardCharsets.UTF_8); byte[] request = join(chineseBytes, new byte[] {'\b'}); testDecode_assertEquals(request, Codec2.DecodeResult.NEED_MORE_INPUT, new String(new byte[] {32, 32, 8, 8})); // There may be some problem handling chinese (negative number recognition). Ignoring this problem, the diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/HttpHeaderNames.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/HttpHeaderNames.java index a701870f73d..27b54ada1b4 100644 --- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/HttpHeaderNames.java +++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/HttpHeaderNames.java @@ -50,6 +50,8 @@ public enum HttpHeaderNames { TE(io.netty.handler.codec.http.HttpHeaderNames.TE), + CONNECTION(io.netty.handler.codec.http.HttpHeaderNames.CONNECTION), + ALT_SVC("alt-svc"); private final String name; diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/MethodMetadata.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/MethodMetadata.java index 7f87edafbc4..2c20af654ce 100644 --- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/MethodMetadata.java +++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/MethodMetadata.java @@ -20,9 +20,6 @@ import org.apache.dubbo.rpc.model.ReflectionMethodDescriptor; import org.apache.dubbo.rpc.model.StubMethodDescriptor; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - public class MethodMetadata { private final Class[] actualRequestTypes; @@ -64,19 +61,9 @@ private static MethodMetadata doResolveReflection(ReflectionMethodDescriptor met switch (method.getRpcType()) { case CLIENT_STREAM: case BI_STREAM: - actualRequestTypes = new Class[] { - obtainActualTypeInStreamObserver( - ((ParameterizedType) method.getMethod().getGenericReturnType()).getActualTypeArguments()[0]) - }; - actualResponseType = obtainActualTypeInStreamObserver( - ((ParameterizedType) method.getMethod().getGenericParameterTypes()[0]) - .getActualTypeArguments()[0]); - return new MethodMetadata(actualRequestTypes, actualResponseType); case SERVER_STREAM: - actualRequestTypes = new Class[] {method.getMethod().getParameterTypes()[0]}; - actualResponseType = obtainActualTypeInStreamObserver( - ((ParameterizedType) method.getMethod().getGenericParameterTypes()[1]) - .getActualTypeArguments()[0]); + actualRequestTypes = method.getActualRequestTypes(); + actualResponseType = method.getActualResponseType(); return new MethodMetadata(actualRequestTypes, actualResponseType); case UNARY: actualRequestTypes = method.getParameterClasses(); @@ -85,11 +72,4 @@ private static MethodMetadata doResolveReflection(ReflectionMethodDescriptor met } throw new IllegalStateException("Can not reach here"); } - - static Class obtainActualTypeInStreamObserver(Type typeInStreamObserver) { - return (Class) - (typeInStreamObserver instanceof ParameterizedType - ? ((ParameterizedType) typeInStreamObserver).getRawType() - : typeInStreamObserver); - } } diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/netty4/h1/NettyHttp1Codec.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/netty4/h1/NettyHttp1Codec.java index 07f04be22eb..594b77e63a3 100644 --- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/netty4/h1/NettyHttp1Codec.java +++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/netty4/h1/NettyHttp1Codec.java @@ -31,21 +31,27 @@ import io.netty.buffer.ByteBufInputStream; import io.netty.buffer.ByteBufOutputStream; import io.netty.channel.ChannelDuplexHandler; +import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.FullHttpRequest; +import io.netty.handler.codec.http.HttpHeaderValues; import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.handler.codec.http.HttpUtil; import io.netty.handler.codec.http.HttpVersion; import io.netty.handler.codec.http.LastHttpContent; public class NettyHttp1Codec extends ChannelDuplexHandler { + private boolean keepAlive; + @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { // decode FullHttpRequest if (msg instanceof FullHttpRequest) { FullHttpRequest request = (FullHttpRequest) msg; + keepAlive = HttpUtil.isKeepAlive(request); super.channelRead( ctx, new DefaultHttp1Request( @@ -80,13 +86,22 @@ private void doWriteHeader(ChannelHandlerContext ctx, HttpMetadata msg, ChannelP if (CollectionUtils.isNotEmpty(statusHeaders)) { status = HttpResponseStatus.valueOf(Integer.parseInt(statusHeaders.get(0))); } + if (keepAlive) { + headers.add(HttpHeaderNames.CONNECTION.getKey(), String.valueOf(HttpHeaderValues.KEEP_ALIVE)); + } else { + headers.add(HttpHeaderNames.CONNECTION.getKey(), String.valueOf(HttpHeaderValues.CLOSE)); + } // process normal headers ctx.writeAndFlush(new DefaultHttpResponse(HttpVersion.HTTP_1_1, status, headers.getHeaders()), promise); } private void doWriteMessage(ChannelHandlerContext ctx, HttpOutputMessage msg, ChannelPromise promise) { if (HttpOutputMessage.EMPTY_MESSAGE == msg) { - ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, promise); + if (keepAlive) { + ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, promise); + } else { + ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, promise).addListener(ChannelFutureListener.CLOSE); + } return; } OutputStream body = msg.getBody(); diff --git a/dubbo-rpc/dubbo-rpc-triple/pom.xml b/dubbo-rpc/dubbo-rpc-triple/pom.xml index 1b4bebf035c..5d0a0140c4c 100644 --- a/dubbo-rpc/dubbo-rpc-triple/pom.xml +++ b/dubbo-rpc/dubbo-rpc-triple/pom.xml @@ -123,6 +123,12 @@ spock-core test + + org.apache.dubbo + dubbo-compiler + ${project.parent.version} + true + diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java index 8fc8867a438..4fd388d3362 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java @@ -73,19 +73,9 @@ public ReflectionPackableMethod( switch (method.getRpcType()) { case CLIENT_STREAM: case BI_STREAM: - actualRequestTypes = new Class[] { - obtainActualTypeInStreamObserver( - ((ParameterizedType) method.getMethod().getGenericReturnType()).getActualTypeArguments()[0]) - }; - actualResponseType = obtainActualTypeInStreamObserver( - ((ParameterizedType) method.getMethod().getGenericParameterTypes()[0]) - .getActualTypeArguments()[0]); - break; case SERVER_STREAM: - actualRequestTypes = method.getMethod().getParameterTypes(); - actualResponseType = obtainActualTypeInStreamObserver( - ((ParameterizedType) method.getMethod().getGenericParameterTypes()[1]) - .getActualTypeArguments()[0]); + actualRequestTypes = method.getActualRequestTypes(); + actualResponseType = method.getActualResponseType(); break; case UNARY: actualRequestTypes = method.getParameterClasses(); @@ -411,6 +401,9 @@ public byte[] pack(Object obj) throws IOException { for (String type : argumentsType) { builder.addArgTypes(type); } + if (actualRequestTypes == null || actualRequestTypes.length == 0) { + return builder.build().toByteArray(); + } ByteArrayOutputStream bos = new ByteArrayOutputStream(); for (int i = 0; i < arguments.length; i++) { Object argument = arguments[i]; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java index 6a26fbc32f2..278524e4acc 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java @@ -207,10 +207,20 @@ private static boolean isSync(MethodDescriptor methodDescriptor, Invocation invo AsyncRpcResult invokeServerStream(MethodDescriptor methodDescriptor, Invocation invocation, ClientCall call) { RequestMetadata request = createRequest(methodDescriptor, invocation, null); - StreamObserver responseObserver = - (StreamObserver) invocation.getArguments()[1]; - final StreamObserver requestObserver = streamCall(call, request, responseObserver); - requestObserver.onNext(invocation.getArguments()[0]); + Object[] arguments = invocation.getArguments(); + final StreamObserver requestObserver; + if (arguments.length == 2) { + StreamObserver responseObserver = (StreamObserver) arguments[1]; + requestObserver = streamCall(call, request, responseObserver); + requestObserver.onNext(invocation.getArguments()[0]); + } else if (arguments.length == 1) { + StreamObserver responseObserver = (StreamObserver) arguments[0]; + requestObserver = streamCall(call, request, responseObserver); + requestObserver.onNext(null); + } else { + throw new IllegalStateException( + "The first parameter must be a StreamObserver when there are no parameters, or the second parameter must be a StreamObserver when there are parameters"); + } requestObserver.onCompleted(); return new AsyncRpcResult(CompletableFuture.completedFuture(new AppResponse()), invocation); } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/ServerStreamServerCallListener.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/ServerStreamServerCallListener.java index 62fe3d74053..8c6a83f37a1 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/ServerStreamServerCallListener.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/ServerStreamServerCallListener.java @@ -33,6 +33,13 @@ public void onReturn(Object value) {} @Override public void onMessage(Object message) { + Class[] params = invocation.getParameterTypes(); + if (params.length == 1) { + if (params[0].isInstance(responseObserver)) { + invocation.setArguments(new Object[] {responseObserver}); + return; + } + } if (message instanceof Object[]) { message = ((Object[]) message)[0]; } diff --git a/dubbo-spring-boot-project/dubbo-spring-boot-actuator/src/main/resources/META-INF/dubbo-endpoints-default.properties b/dubbo-spring-boot-project/dubbo-spring-boot-actuator/src/main/resources/META-INF/dubbo-endpoints-default.properties index 36078408ea9..62fef69fa7e 100644 --- a/dubbo-spring-boot-project/dubbo-spring-boot-actuator/src/main/resources/META-INF/dubbo-endpoints-default.properties +++ b/dubbo-spring-boot-project/dubbo-spring-boot-actuator/src/main/resources/META-INF/dubbo-endpoints-default.properties @@ -10,9 +10,6 @@ management.endpoints.web.path-mapping.dubboservices = dubbo/services management.endpoints.web.path-mapping.dubboreferences = dubbo/references management.endpoints.web.path-mapping.dubboproperties = dubbo/properties -# Set endpoint enablement to be opt-in rather than opt-out -management.endpoints.enabled-by-default = false - # Set enabled for Dubbo Endpoints management.endpoint.dubbo.enabled = true management.endpoint.dubbo.ready.enabled = true diff --git a/dubbo-test/dubbo-test-check/pom.xml b/dubbo-test/dubbo-test-check/pom.xml index 19cf284369a..3a7fd3df9db 100644 --- a/dubbo-test/dubbo-test-check/pom.xml +++ b/dubbo-test/dubbo-test-check/pom.xml @@ -33,7 +33,7 @@ 4.2.0 1.27.1 1.4.0 - 2.12.3 + 2.12.4 diff --git a/pom.xml b/pom.xml index 6d8216a760e..879002d0c60 100644 --- a/pom.xml +++ b/pom.xml @@ -164,8 +164,8 @@ 3.0.2 - 6.2.0 - 3.4.0 + 6.2.1 + 3.4.1 3.22.3 1.54.0 @@ -1096,7 +1096,7 @@ spring-boot-3 - 10.1.31 + 10.1.34