This is an automated email from the ASF dual-hosted git repository.
crazyhzm pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.1 by this push:
new c5815be7b6 Fix native image compile failure and run binary package
failure (#11066)
c5815be7b6 is described below
commit c5815be7b62c0673a912e1fce45b5246325c4c51
Author: huazhongming <[email protected]>
AuthorDate: Mon Dec 5 11:56:37 2022 +0800
Fix native image compile failure and run binary package failure (#11066)
* fix native image failed
Signed-off-by: crazyhzm <[email protected]>
* fix native image failed
Signed-off-by: crazyhzm <[email protected]>
* remove import
Signed-off-by: crazyhzm <[email protected]>
Signed-off-by: crazyhzm <[email protected]>
---
.gitignore | 6 ++
.../org/apache/dubbo/config/AbstractConfig.java | 7 +-
.../dubbo-demo-native-consumer/pom.xml | 19 ++++
.../dubbo/demo/graalvm/consumer/Application.java | 10 +-
.../dubbo-demo-native-provider/pom.xml | 20 ++++
.../dubbo/demo/graalvm/provider/Application.java | 25 +++--
.../META-INF/native-image/reflect-config.json | 115 +++++++++++++++++++--
.../META-INF/native-image/resource-config.json | 6 ++
.../metrics/MetricsReporterFactory$Adaptive.java} | 16 +--
.../common/serialize/Serialization$Adaptive.java | 4 +-
.../report/MetadataReportFactory$Adaptive.java | 2 +-
.../dubbo/registry/RegistryFactory$Adaptive.java | 2 +-
.../pu/PortUnificationTransporter$Adaptive.java | 39 +++++++
.../router/state/StateRouterFactory$Adaptive.java | 7 +-
14 files changed, 241 insertions(+), 37 deletions(-)
diff --git a/.gitignore b/.gitignore
index 87a564393d..0eb7f3d19e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,3 +48,9 @@ dubbo-demo/dubbo-demo-triple/build/*
# global registry center
.tmp
+
+dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/src/main/resources/META-INF/native-image
+dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/src/main/generated
+dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/src/main/resources/META-INF/native-image
+dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/src/main/generated
+
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java
b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java
index 53109a3564..e2bb8dc668 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java
@@ -743,7 +743,12 @@ public abstract class AbstractConfig implements
Serializable {
&&
ClassUtils.isTypeMatch(method.getParameterTypes()[0], value)
&& !isIgnoredAttribute(obj.getClass(), propertyName)) {
value = environment.resolvePlaceholders(value);
- method.invoke(obj,
ClassUtils.convertPrimitive(ScopeModelUtil.getFrameworkModel(getScopeModel()),
method.getParameterTypes()[0], value));
+ if (StringUtils.hasText(value)) {
+ Object arg =
ClassUtils.convertPrimitive(ScopeModelUtil.getFrameworkModel(getScopeModel()),
method.getParameterTypes()[0], value);
+ if (arg != null) {
+ method.invoke(obj, arg);
+ }
+ }
}
} catch (Exception e) {
logger.info("Failed to override the property " +
method.getName() + " in " +
diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
index d23b171ad6..c0fa8b3015 100644
--- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
+++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
@@ -85,6 +85,16 @@
<artifactId>dubbo-remoting-http</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-native</artifactId>
+ </dependency>
+
</dependencies>
<profiles>
@@ -184,11 +194,20 @@
--initialize-at-run-time=io.netty.channel.unix.Limits
--initialize-at-run-time=io.netty.channel.unix.Socket
--initialize-at-run-time=io.netty.channel.ChannelHandlerMask
+
--initialize-at-run-time=io.netty.internal.tcnative.CertificateVerifier
+
--initialize-at-run-time=io.netty.internal.tcnative.AsyncSSLPrivateKeyMethod
+
--initialize-at-run-time=io.netty.handler.ssl.ReferenceCountedOpenSslEngine
+
--initialize-at-run-time=io.netty.handler.ssl.OpenSslPrivateKeyMethod
+
--initialize-at-run-time=io.netty.internal.tcnative.CertificateVerifier
+
--initialize-at-run-time=io.netty.internal.tcnative.SSL
+
--initialize-at-run-time=io.netty.handler.ssl.OpenSslAsyncPrivateKeyMethod
+
--initialize-at-run-time=io.netty.internal.tcnative.SSLPrivateKeyMethod
--report-unsupported-elements-at-runtime
--allow-incomplete-classpath
--enable-url-protocols=http
-H:+ReportExceptionStackTraces
+ -H:+AllowJRTFileSystem
</buildArgs>
</configuration>
</plugin>
diff --git
a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/src/main/java/com/apache/dubbo/demo/graalvm/consumer/Application.java
b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/src/main/java/com/apache/dubbo/demo/graalvm/consumer/Application.java
index 1c253d820c..d227b6c2e4 100644
---
a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/src/main/java/com/apache/dubbo/demo/graalvm/consumer/Application.java
+++
b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/src/main/java/com/apache/dubbo/demo/graalvm/consumer/Application.java
@@ -33,6 +33,7 @@ public class Application {
public static void main(String[] args) {
System.setProperty("dubbo.application.logger", "log4j");
System.setProperty("native", "true");
+ System.setProperty("dubbo.json-framework.prefer","fastjson");
if (isClassic(args)) {
runWithRefer();
} else {
@@ -45,11 +46,8 @@ public class Application {
}
private static void runWithBootstrap() {
- ReferenceConfig<DemoService> reference = new ReferenceConfig<>();
- reference.setInterface(DemoService.class);
- reference.setGeneric("false");
-
DubboBootstrap bootstrap = DubboBootstrap.getInstance();
+
ApplicationConfig applicationConfig = new
ApplicationConfig("dubbo-demo-api-consumer");
applicationConfig.setQosEnable(false);
applicationConfig.setCompiler("jdk");
@@ -57,6 +55,10 @@ public class Application {
m.put("proxy", "jdk");
applicationConfig.setParameters(m);
+ ReferenceConfig<DemoService> reference = new ReferenceConfig<>();
+ reference.setInterface(DemoService.class);
+ reference.setGeneric("false");
+
bootstrap.application(applicationConfig)
.registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
.protocol(new ProtocolConfig(CommonConstants.DUBBO, -1))
diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
index 5319a3553a..98caedd58f 100644
--- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
+++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
@@ -79,6 +79,17 @@
<artifactId>dubbo-remoting-http</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-native</artifactId>
+ </dependency>
+
+
</dependencies>
@@ -180,11 +191,20 @@
--initialize-at-run-time=io.netty.channel.unix.Limits
--initialize-at-run-time=io.netty.channel.unix.Socket
--initialize-at-run-time=io.netty.channel.ChannelHandlerMask
+
--initialize-at-run-time=io.netty.internal.tcnative.CertificateVerifier
+
--initialize-at-run-time=io.netty.internal.tcnative.AsyncSSLPrivateKeyMethod
+
--initialize-at-run-time=io.netty.handler.ssl.ReferenceCountedOpenSslEngine
+
--initialize-at-run-time=io.netty.handler.ssl.OpenSslPrivateKeyMethod
+
--initialize-at-run-time=io.netty.internal.tcnative.CertificateVerifier
+
--initialize-at-run-time=io.netty.internal.tcnative.SSL
+
--initialize-at-run-time=io.netty.handler.ssl.OpenSslAsyncPrivateKeyMethod
+
--initialize-at-run-time=io.netty.internal.tcnative.SSLPrivateKeyMethod
--report-unsupported-elements-at-runtime
--allow-incomplete-classpath
--enable-url-protocols=http
-H:+ReportExceptionStackTraces
+ -H:+AllowJRTFileSystem
</buildArgs>
</configuration>
</plugin>
diff --git
a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/src/main/java/org/apache/dubbo/demo/graalvm/provider/Application.java
b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/src/main/java/org/apache/dubbo/demo/graalvm/provider/Application.java
index 60d21c93c4..66b0796c44 100644
---
a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/src/main/java/org/apache/dubbo/demo/graalvm/provider/Application.java
+++
b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/src/main/java/org/apache/dubbo/demo/graalvm/provider/Application.java
@@ -24,6 +24,7 @@ import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apace.dubbo.graalvm.demo.DemoService;
+import org.apache.dubbo.rpc.model.ModuleModel;
import java.util.HashMap;
import java.util.Map;
@@ -34,6 +35,7 @@ public class Application {
public static void main(String[] args) throws Exception {
System.setProperty("dubbo.application.logger", "log4j");
System.setProperty("native", "true");
+ System.setProperty("dubbo.json-framework.prefer","fastjson");
if (isClassic(args)) {
startWithExport();
} else {
@@ -47,32 +49,30 @@ public class Application {
}
private static void startWithBootstrap() {
- ServiceConfig<DemoServiceImpl> service = new ServiceConfig<>();
- service.setInterface(DemoService.class);
- service.setRef(new DemoServiceImpl());
-
DubboBootstrap bootstrap = DubboBootstrap.getInstance();
- ApplicationConfig applicationConfig = new
ApplicationConfig("dubbo-demo-api-provider");
+ ApplicationConfig applicationConfig = new ApplicationConfig(
"dubbo-demo-api-provider");
applicationConfig.setQosEnable(false);
applicationConfig.setCompiler("jdk");
Map<String, String> m = new HashMap<>(1);
m.put("proxy", "jdk");
applicationConfig.setParameters(m);
+ ServiceConfig<DemoService> service = new ServiceConfig<>();
+ service.setInterface(DemoService.class);
+ service.setRef(new DemoServiceImpl());
+
bootstrap.application(applicationConfig)
.registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
.protocol(new ProtocolConfig(CommonConstants.DUBBO, -1))
.service(service)
.start()
.await();
+
+ System.out.println("dubbo service started");
}
private static void startWithExport() throws InterruptedException {
- ServiceConfig<DemoServiceImpl> service = new ServiceConfig<>();
- service.setInterface(DemoService.class);
- service.setRef(new DemoServiceImpl());
-
ApplicationConfig applicationConfig = new
ApplicationConfig("dubbo-demo-api-provider");
applicationConfig.setQosEnable(false);
applicationConfig.setCompiler("jdk");
@@ -81,6 +81,13 @@ public class Application {
m.put("proxy", "jdk");
applicationConfig.setParameters(m);
+ ModuleModel moduleModel =
applicationConfig.getApplicationModel().newModule();
+
+
+ ServiceConfig<DemoService> service = new ServiceConfig<>(moduleModel);
+ service.setInterface(DemoService.class);
+ service.setRef(new DemoServiceImpl());
+
service.setApplication(applicationConfig);
service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
service.export();
diff --git
a/dubbo-native-plugin/src/main/resources/META-INF/native-image/reflect-config.json
b/dubbo-native-plugin/src/main/resources/META-INF/native-image/reflect-config.json
index 84975373e9..38d23920d7 100644
---
a/dubbo-native-plugin/src/main/resources/META-INF/native-image/reflect-config.json
+++
b/dubbo-native-plugin/src/main/resources/META-INF/native-image/reflect-config.json
@@ -1107,7 +1107,7 @@
"methods": [
{
"name": "<init>",
- "parameterTypes": []
+ "parameterTypes": ["org.apache.dubbo.rpc.model.ApplicationModel"]
}
]
},
@@ -1332,7 +1332,13 @@
},
{
"name": "org.apache.dubbo.config.deploy.DefaultApplicationDeployer",
- "allPublicConstructors": true
+ "allPublicConstructors": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": ["org.apache.dubbo.rpc.model.ApplicationModel"]
+ }
+ ]
},
{
"name": "org.apache.dubbo.config.deploy.DefaultModuleDeployer",
@@ -1481,7 +1487,7 @@
"methods": [
{
"name": "<init>",
- "parameterTypes": []
+ "parameterTypes": ["org.apache.dubbo.rpc.model.ApplicationModel"]
}
]
},
@@ -2062,7 +2068,13 @@
{
"name":
"org.apache.dubbo.rpc.cluster.filter.support.ConsumerContextFilter",
"allPublicMethods": true,
- "allPublicConstructors": true
+ "allPublicConstructors": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
},
{
"name": "org.apache.dubbo.rpc.cluster.filter.support.ZoneAwareFilter"
@@ -2347,9 +2359,6 @@
{
"name": "org.apache.dubbo.rpc.filter.CompatibleFilter"
},
- {
- "name": "org.apache.dubbo.rpc.filter.ContextFilter"
- },
{
"name": "org.apache.dubbo.rpc.filter.DeprecatedFilter"
},
@@ -2671,5 +2680,97 @@
"parameterTypes": []
}
]
+ },
+ {
+ "name": "org.apache.dubbo.rpc.cluster.router.RouterSnapshotSwitcher",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "name":
"org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "name": "org.apache.dubbo.common.convert.ConverterUtil",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": ["org.apache.dubbo.rpc.model.FrameworkModel"]
+ }
+ ]
+ },
+ {
+ "name": "org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleManager",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": ["org.apache.dubbo.rpc.model.ModuleModel"]
+ }
+ ]
+ },
+ {
+ "name": "org.apache.dubbo.config.context.ModuleConfigManager",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": ["org.apache.dubbo.rpc.model.ModuleModel"]
+ }
+ ]
+ },
+ {
+ "name": "org.apache.dubbo.common.store.support.SimpleDataStore",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "name":
"org.apache.dubbo.common.metrics.collector.DefaultMetricsCollector",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": ["org.apache.dubbo.rpc.model.ApplicationModel"]
+ }
+ ]
+ },
+ {
+ "name": "org.apache.dubbo.config.deploy.DefaultMetricsServiceExporter",
+ "allPublicMethods": true,
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "name": "com.alibaba.fastjson.JSON",
+ "allPublicMethods": true
+ },
+ {
+ "name": "java.util.Collections$UnmodifiableMap",
+ "allPublicMethods": true
+ },
+ {
+ "name": "java.util.Collections$UnmodifiableCollection",
+ "allPublicMethods": true
}
]
diff --git
a/dubbo-native-plugin/src/main/resources/META-INF/native-image/resource-config.json
b/dubbo-native-plugin/src/main/resources/META-INF/native-image/resource-config.json
index 2d1ac938e9..977e6eb3d1 100644
---
a/dubbo-native-plugin/src/main/resources/META-INF/native-image/resource-config.json
+++
b/dubbo-native-plugin/src/main/resources/META-INF/native-image/resource-config.json
@@ -153,6 +153,12 @@
},
{
"pattern": "\\Qorg/apache/dubbo/remoting/exchange/Exchangers.class\\E"
+ },
+ {
+ "pattern":
"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.store.DataStore\\E"
+ },
+ {
+ "pattern":
"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.metrics.service.MetricsServiceExporter\\E"
}
]
},
diff --git
a/dubbo-native/src/main/java/org/apache/dubbo/registry/RegistryFactory$Adaptive.java
b/dubbo-native/src/main/java/org/apache/dubbo/common/metrics/MetricsReporterFactory$Adaptive.java
similarity index 57%
copy from
dubbo-native/src/main/java/org/apache/dubbo/registry/RegistryFactory$Adaptive.java
copy to
dubbo-native/src/main/java/org/apache/dubbo/common/metrics/MetricsReporterFactory$Adaptive.java
index 85bb0b61d1..aa288ce381 100644
---
a/dubbo-native/src/main/java/org/apache/dubbo/registry/RegistryFactory$Adaptive.java
+++
b/dubbo-native/src/main/java/org/apache/dubbo/common/metrics/MetricsReporterFactory$Adaptive.java
@@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.registry;
+package org.apache.dubbo.common.metrics;
import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;
-public class RegistryFactory$Adaptive implements
org.apache.dubbo.registry.RegistryFactory {
-public org.apache.dubbo.registry.Registry
getRegistry(org.apache.dubbo.common.URL arg0) {
+public class MetricsReporterFactory$Adaptive implements
org.apache.dubbo.common.metrics.MetricsReporterFactory {
+public org.apache.dubbo.common.metrics.MetricsReporter
createMetricsReporter(org.apache.dubbo.common.URL arg0) {
if (arg0 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
-String extName = ( url.getProtocol() == null ? "dubbo" : url.getProtocol() );
-if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.registry.RegistryFactory) name from url (" + url.toString() +
") use keys([protocol])");
-ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.registry.RegistryFactory.class);
-org.apache.dubbo.registry.RegistryFactory extension =
(org.apache.dubbo.registry.RegistryFactory)scopeModel.getExtensionLoader(org.apache.dubbo.registry.RegistryFactory.class).getExtension(extName);
-return extension.getRegistry(arg0);
+String extName = ( url.getProtocol() == null ? "nop" : url.getProtocol() );
+if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.common.metrics.MetricsReporterFactory) name from url (" +
url.toString() + ") use keys([protocol])");
+ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.common.metrics.MetricsReporterFactory.class);
+org.apache.dubbo.common.metrics.MetricsReporterFactory extension =
(org.apache.dubbo.common.metrics.MetricsReporterFactory)scopeModel.getExtensionLoader(org.apache.dubbo.common.metrics.MetricsReporterFactory.class).getExtension(extName);
+return extension.createMetricsReporter(arg0);
}
}
diff --git
a/dubbo-native/src/main/java/org/apache/dubbo/common/serialize/Serialization$Adaptive.java
b/dubbo-native/src/main/java/org/apache/dubbo/common/serialize/Serialization$Adaptive.java
index 9bf19889e7..ae3a0b6d6a 100644
---
a/dubbo-native/src/main/java/org/apache/dubbo/common/serialize/Serialization$Adaptive.java
+++
b/dubbo-native/src/main/java/org/apache/dubbo/common/serialize/Serialization$Adaptive.java
@@ -27,7 +27,7 @@ throw new UnsupportedOperationException("The method public
abstract java.lang.St
public org.apache.dubbo.common.serialize.ObjectInput
deserialize(org.apache.dubbo.common.URL arg0, java.io.InputStream arg1) throws
java.io.IOException {
if (arg0 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
-String extName = url.getParameter("serialization", "hessian2");
+String extName = url.getParameter("serialization", "adaptive");
if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.common.serialize.Serialization) name from url (" +
url.toString() + ") use keys([serialization])");
ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.common.serialize.Serialization.class);
org.apache.dubbo.common.serialize.Serialization extension =
(org.apache.dubbo.common.serialize.Serialization)scopeModel.getExtensionLoader(org.apache.dubbo.common.serialize.Serialization.class).getExtension(extName);
@@ -36,7 +36,7 @@ return extension.deserialize(arg0, arg1);
public org.apache.dubbo.common.serialize.ObjectOutput
serialize(org.apache.dubbo.common.URL arg0, java.io.OutputStream arg1) throws
java.io.IOException {
if (arg0 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
-String extName = url.getParameter("serialization", "hessian2");
+String extName = url.getParameter("serialization", "adaptive");
if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.common.serialize.Serialization) name from url (" +
url.toString() + ") use keys([serialization])");
ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.common.serialize.Serialization.class);
org.apache.dubbo.common.serialize.Serialization extension =
(org.apache.dubbo.common.serialize.Serialization)scopeModel.getExtensionLoader(org.apache.dubbo.common.serialize.Serialization.class).getExtension(extName);
diff --git
a/dubbo-native/src/main/java/org/apache/dubbo/metadata/report/MetadataReportFactory$Adaptive.java
b/dubbo-native/src/main/java/org/apache/dubbo/metadata/report/MetadataReportFactory$Adaptive.java
index 069e3b940f..0816ad1ec3 100644
---
a/dubbo-native/src/main/java/org/apache/dubbo/metadata/report/MetadataReportFactory$Adaptive.java
+++
b/dubbo-native/src/main/java/org/apache/dubbo/metadata/report/MetadataReportFactory$Adaptive.java
@@ -28,6 +28,6 @@ org.apache.dubbo.metadata.report.MetadataReportFactory
extension = (org.apache.d
return extension.getMetadataReport(arg0);
}
public void destroy() {
-throw new UnsupportedOperationException("The method public abstract void
org.apache.dubbo.metadata.report.MetadataReportFactory.destroy() of interface
org.apache.dubbo.metadata.report.MetadataReportFactory is not adaptive
method!");
+throw new UnsupportedOperationException("The method public default void
org.apache.dubbo.metadata.report.MetadataReportFactory.destroy() of interface
org.apache.dubbo.metadata.report.MetadataReportFactory is not adaptive
method!");
}
}
diff --git
a/dubbo-native/src/main/java/org/apache/dubbo/registry/RegistryFactory$Adaptive.java
b/dubbo-native/src/main/java/org/apache/dubbo/registry/RegistryFactory$Adaptive.java
index 85bb0b61d1..8b3ebc963e 100644
---
a/dubbo-native/src/main/java/org/apache/dubbo/registry/RegistryFactory$Adaptive.java
+++
b/dubbo-native/src/main/java/org/apache/dubbo/registry/RegistryFactory$Adaptive.java
@@ -21,7 +21,7 @@ public class RegistryFactory$Adaptive implements
org.apache.dubbo.registry.Regis
public org.apache.dubbo.registry.Registry
getRegistry(org.apache.dubbo.common.URL arg0) {
if (arg0 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
-String extName = ( url.getProtocol() == null ? "dubbo" : url.getProtocol() );
+String extName = ( url.getProtocol() == null ? "adaptive" : url.getProtocol()
);
if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.registry.RegistryFactory) name from url (" + url.toString() +
") use keys([protocol])");
ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.registry.RegistryFactory.class);
org.apache.dubbo.registry.RegistryFactory extension =
(org.apache.dubbo.registry.RegistryFactory)scopeModel.getExtensionLoader(org.apache.dubbo.registry.RegistryFactory.class).getExtension(extName);
diff --git
a/dubbo-native/src/main/java/org/apache/dubbo/remoting/api/pu/PortUnificationTransporter$Adaptive.java
b/dubbo-native/src/main/java/org/apache/dubbo/remoting/api/pu/PortUnificationTransporter$Adaptive.java
new file mode 100644
index 0000000000..3f6c242732
--- /dev/null
+++
b/dubbo-native/src/main/java/org/apache/dubbo/remoting/api/pu/PortUnificationTransporter$Adaptive.java
@@ -0,0 +1,39 @@
+/*
+ * 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.remoting.api.pu;
+import org.apache.dubbo.rpc.model.ScopeModel;
+import org.apache.dubbo.rpc.model.ScopeModelUtil;
+public class PortUnificationTransporter$Adaptive implements
org.apache.dubbo.remoting.api.pu.PortUnificationTransporter {
+public org.apache.dubbo.remoting.Client connect(org.apache.dubbo.common.URL
arg0, org.apache.dubbo.remoting.ChannelHandler arg1) throws
org.apache.dubbo.remoting.RemotingException {
+if (arg0 == null) throw new IllegalArgumentException("url == null");
+org.apache.dubbo.common.URL url = arg0;
+String extName = url.getParameter("client", url.getParameter("transporter",
"netty4"));
+if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.remoting.api.pu.PortUnificationTransporter) name from url ("
+ url.toString() + ") use keys([client, transporter])");
+ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.remoting.api.pu.PortUnificationTransporter.class);
+org.apache.dubbo.remoting.api.pu.PortUnificationTransporter extension =
(org.apache.dubbo.remoting.api.pu.PortUnificationTransporter)scopeModel.getExtensionLoader(org.apache.dubbo.remoting.api.pu.PortUnificationTransporter.class).getExtension(extName);
+return extension.connect(arg0, arg1);
+}
+public org.apache.dubbo.remoting.api.pu.AbstractPortUnificationServer
bind(org.apache.dubbo.common.URL arg0, org.apache.dubbo.remoting.ChannelHandler
arg1) throws org.apache.dubbo.remoting.RemotingException {
+if (arg0 == null) throw new IllegalArgumentException("url == null");
+org.apache.dubbo.common.URL url = arg0;
+String extName = url.getParameter("server", url.getParameter("transporter",
"netty4"));
+if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.remoting.api.pu.PortUnificationTransporter) name from url ("
+ url.toString() + ") use keys([server, transporter])");
+ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.remoting.api.pu.PortUnificationTransporter.class);
+org.apache.dubbo.remoting.api.pu.PortUnificationTransporter extension =
(org.apache.dubbo.remoting.api.pu.PortUnificationTransporter)scopeModel.getExtensionLoader(org.apache.dubbo.remoting.api.pu.PortUnificationTransporter.class).getExtension(extName);
+return extension.bind(arg0, arg1);
+}
+}
diff --git
a/dubbo-native/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterFactory$Adaptive.java
b/dubbo-native/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterFactory$Adaptive.java
index 2dc6ccf2fc..c33747dc83 100644
---
a/dubbo-native/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterFactory$Adaptive.java
+++
b/dubbo-native/src/main/java/org/apache/dubbo/rpc/cluster/router/state/StateRouterFactory$Adaptive.java
@@ -15,17 +15,16 @@
* limitations under the License.
*/
package org.apache.dubbo.rpc.cluster.router.state;
-import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;
public class StateRouterFactory$Adaptive implements
org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory {
-public <T> org.apache.dubbo.rpc.cluster.router.state.StateRouter<T>
getRouter(Class<T> arg0, URL arg1) {
-if (arg0 == null) throw new IllegalArgumentException("url == null");
+public org.apache.dubbo.rpc.cluster.router.state.StateRouter
getRouter(java.lang.Class arg0, org.apache.dubbo.common.URL arg1) {
+if (arg1 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg1;
String extName = ( url.getProtocol() == null ? "adaptive" : url.getProtocol()
);
if(extName == null) throw new IllegalStateException("Failed to get extension
(org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory) name from url ("
+ url.toString() + ") use keys([protocol])");
ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory.class);
org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory extension =
(org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory)scopeModel.getExtensionLoader(org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory.class).getExtension(extName);
-return extension.getRouter(arg0,arg1);
+return extension.getRouter(arg0, arg1);
}
}