This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new bde608ec3c fail fast when protocol exp (#12361)
bde608ec3c is described below
commit bde608ec3cf0cad32e2704e89e008a83bc27c46c
Author: wxbty <[email protected]>
AuthorDate: Mon Jun 12 20:47:02 2023 +0800
fail fast when protocol exp (#12361)
* fail fast when protocol exp
* use hasExtension
* Adjust the spi detection position
* remove unuse
* remove unuse
---
.../apache/dubbo/registry/integration/RegistryDirectory.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
index 9cbedfbc47..6405c75eab 100644
---
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
+++
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
@@ -119,6 +119,18 @@ public class RegistryDirectory<T> extends
DynamicDirectory<T> {
@Override
public void subscribe(URL url) {
+
+ // Fail-fast detection protocol spi
+ String queryProtocols = this.queryMap.get(PROTOCOL_KEY);
+ if (StringUtils.isNotBlank(queryProtocols)) {
+ String[] acceptProtocols = queryProtocols.split(",");
+ for (String acceptProtocol : acceptProtocols) {
+ if
(!moduleModel.getApplicationModel().getExtensionLoader(Protocol.class).hasExtension(acceptProtocol))
{
+ throw new IllegalStateException("No such extension
org.apache.dubbo.rpc.Protocol by name " + acceptProtocol + ", please check
whether related SPI module is missing");
+ }
+ }
+ }
+
ApplicationModel applicationModel = url.getApplicationModel();
MetricsEventBus.post(RegistryEvent.toSubscribeEvent(applicationModel),() ->
{