support native image(graalvm) for dubbo 3.0.4 (#8966)

This commit is contained in:
张志勇 2021-10-08 10:46:56 +08:00 committed by GitHub
parent 403a98943b
commit c22c589a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 5602 additions and 2431 deletions

View File

@ -33,6 +33,7 @@ import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.common.utils.ConcurrentHashSet;
import org.apache.dubbo.common.utils.ConfigUtils;
import org.apache.dubbo.common.utils.Holder;
import org.apache.dubbo.common.utils.NativeUtils;
import org.apache.dubbo.common.utils.ReflectUtils;
import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.rpc.model.ApplicationModel;
@ -71,7 +72,6 @@ import static java.util.ServiceLoader.load;
import static java.util.stream.StreamSupport.stream;
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.NATIVE;
import static org.apache.dubbo.common.constants.CommonConstants.REMOVE_VALUE_PREFIX;
/**
@ -1165,7 +1165,7 @@ public class ExtensionLoader<T> {
private Class<?> createAdaptiveExtensionClass() {
ClassLoader classLoader = findClassLoader();
try {
if (Boolean.parseBoolean(System.getProperty(NATIVE, "false"))) {
if (NativeUtils.isNative()) {
return classLoader.loadClass(type.getName() + "$Adaptive");
}
} catch (Throwable ignore) {

View File

@ -18,6 +18,7 @@ package org.apache.dubbo.common.utils;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
@ -26,6 +27,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
@ -78,9 +80,15 @@ public class ClassLoaderResourceLoader {
Enumeration<URL> urls = null;
try {
urls = currentClassLoader.getResources(fileName);
boolean isNative = NativeUtils.isNative();
if (urls != null) {
while (urls.hasMoreElements()) {
set.add(urls.nextElement());
URL url = urls.nextElement();
if (isNative) {
//In native mode, the address of each URL is the same instead of different paths, so it is necessary to set the ref to make it different
setRef(url);
}
set.add(url);
}
}
} catch (IOException e) {
@ -92,4 +100,14 @@ public class ClassLoaderResourceLoader {
}
private static void setRef(URL url) {
try {
Field field = URL.class.getDeclaredField("ref");
field.setAccessible(true);
field.set(url, UUID.randomUUID().toString());
} catch (Throwable ignore) {
}
}
}

View File

@ -0,0 +1,28 @@
/*
* 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.utils;
import static org.apache.dubbo.common.constants.CommonConstants.NATIVE;
public abstract class NativeUtils {
public static boolean isNative() {
return Boolean.parseBoolean(System.getProperty(NATIVE, "false"));
}
}

View File

@ -142,6 +142,7 @@
--initialize-at-build-time=org.slf4j.impl.Log4jLoggerFactory
--initialize-at-build-time=org.slf4j.impl.Log4jLoggerAdapter
--initialize-at-build-time=org.eclipse.collections.api.factory.Sets
--initialize-at-build-time=io.netty.util.internal.logging.Log4JLogger
--initialize-at-run-time=io.netty.channel.epoll.Epoll
@ -155,7 +156,6 @@
--initialize-at-run-time=io.netty.channel.unix.Errors
--initialize-at-run-time=io.netty.channel.unix.IovArray
--initialize-at-run-time=io.netty.channel.unix.Limits
--initialize-at-run-time=io.netty.util.internal.logging.Log4JLogger
--initialize-at-run-time=io.netty.channel.unix.Socket
--initialize-at-run-time=io.netty.channel.ChannelHandlerMask

View File

@ -29,6 +29,7 @@ public class Application {
public static void main(String[] args) {
System.setProperty("dubbo.application.logger", "log4j");
System.setProperty("native","true");
if (isClassic(args)) {
runWithRefer();
} else {

View File

@ -1,52 +1,58 @@
{
"_comment": "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.",
"resources":{
"includes":[
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.config.configcenter.DynamicConfigurationFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.context.FrameworkExt\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.extension.ExtensionFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.infra.InfraAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.logger.LoggerAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.hessian2.dubbo.Hessian2FactoryInitializer\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.ThreadPool\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.manager.ExecutorRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.url.component.param.DynamicParamSource\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.ServiceNameMapping\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.WritableMetadataService\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.AddressListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.RegistryClusterIdentifier\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.migration.MigrationAddressComparator\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Codec2\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Dispatcher\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Transporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.exchange.Exchanger\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Filter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.InvokerListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Protocol\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.ProxyFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.Cluster\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.ConfiguratorFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.LoadBalance\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.RouterFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.ClusterFilter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.governance.GovernanceRuleRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.model.BuiltinServiceDetector\\E"},
{"pattern":"\\QMETA-INF/services/org.apache.dubbo.common.extension.LoadingStrategy\\E"},
{"pattern":"\\Qlog4j.properties\\E"},
{"pattern":"\\Qdubbo.properties\\E"},
{"pattern":"\\Qorg/apache/dubbo/common/Version.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/RemotingException.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/Transporters.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/exchange/Exchangers.class\\E"},
{"pattern":"\\Qorg/slf4j/impl/StaticLoggerBinder.class\\E"}
]},
"includes":[
{"pattern":"\\QDENY_CLASS\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.compiler.Compiler\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.config.configcenter.DynamicConfigurationFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.context.ApplicationExt\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.context.ModuleExt\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.extension.ExtensionInjector\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.infra.InfraAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.logger.LoggerAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.hessian2.dubbo.Hessian2FactoryInitializer\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.ThreadPool\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.manager.ExecutorRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.url.component.param.DynamicParamSource\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.MetadataServiceExporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.ServiceNameMapping\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.WritableMetadataService\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.AddressListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.ProviderFirstParams\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.RegistryClusterIdentifier\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceInstanceCustomizer\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.migration.MigrationAddressComparator\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Codec2\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Dispatcher\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Transporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.exchange.Exchanger\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Filter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.InvokerListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Protocol\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.ProxyFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.Cluster\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.ConfiguratorFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.LoadBalance\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.ProviderURLMergeProcessor\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.RouterFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.ClusterFilter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.governance.GovernanceRuleRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.model.BuiltinServiceDetector\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.model.ScopeModelInitializer\\E"},
{"pattern":"\\QMETA-INF/services/org.apache.dubbo.common.extension.LoadingStrategy\\E"},
{"pattern":"\\Qdubbo.properties\\E"},
{"pattern":"\\Qlog4j.properties\\E"},
{"pattern":"\\Qorg/apache/dubbo/common/Version.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/RemotingException.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/Transporters.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/exchange/Exchangers.class\\E"}
]},
"bundles":[]
}

View File

@ -128,6 +128,7 @@
--no-fallback
--initialize-at-build-time=org.slf4j.MDC
--initialize-at-build-time=org.apache.log4j.MDC
--initialize-at-build-time=org.slf4j.LoggerFactory
--initialize-at-build-time=org.slf4j.impl.StaticLoggerBinder
--initialize-at-build-time=org.apache.log4j.helpers.Loader
@ -138,6 +139,7 @@
--initialize-at-build-time=org.slf4j.impl.Log4jLoggerFactory
--initialize-at-build-time=org.slf4j.impl.Log4jLoggerAdapter
--initialize-at-build-time=org.eclipse.collections.api.factory.Sets
--initialize-at-build-time=io.netty.util.internal.logging.Log4JLogger
@ -152,7 +154,6 @@
--initialize-at-run-time=io.netty.channel.unix.Errors
--initialize-at-run-time=io.netty.channel.unix.IovArray
--initialize-at-run-time=io.netty.channel.unix.Limits
--initialize-at-run-time=io.netty.util.internal.logging.Log4JLogger
--initialize-at-run-time=io.netty.channel.unix.Socket
--initialize-at-run-time=io.netty.channel.ChannelHandlerMask

View File

@ -30,7 +30,8 @@ import java.util.concurrent.CountDownLatch;
public class Application {
public static void main(String[] args) throws Exception {
System.setProperty("dubbo.application.logger", "jdk");
System.setProperty("dubbo.application.logger", "log4j");
System.setProperty("native", "true");
if (isClassic(args)) {
startWithExport();
} else {
@ -68,7 +69,16 @@ public class Application {
ServiceConfig<DemoServiceImpl> service = new ServiceConfig<>();
service.setInterface(DemoService.class);
service.setRef(new DemoServiceImpl());
service.setApplication(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);
service.setApplication(applicationConfig);
service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
service.export();

View File

@ -0,0 +1,25 @@
#
#
# 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.
#
#
log4j.rootLogger=error, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%-12d{HH\:mm\:ss.SS}] [%p] %l %m%n

View File

@ -1,45 +1,58 @@
{
"_comment": "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.",
"resources":{
"includes":[
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.compiler.Compiler\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.config.configcenter.DynamicConfigurationFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.context.FrameworkExt\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.extension.ExtensionFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.infra.InfraAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.logger.LoggerAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.hessian2.dubbo.Hessian2FactoryInitializer\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.ThreadPool\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.manager.ExecutorRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.url.component.param.DynamicParamSource\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.ServiceNameMapping\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.WritableMetadataService\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.RegistryClusterIdentifier\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceInstanceCustomizer\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Codec2\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Dispatcher\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Transporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.exchange.Exchanger\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Filter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Protocol\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.ProxyFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.ConfiguratorFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.governance.GovernanceRuleRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.model.BuiltinServiceDetector\\E"},
{"pattern":"\\QMETA-INF/services/org.apache.dubbo.common.extension.LoadingStrategy\\E"},
{"pattern":"\\Qorg/apache/dubbo/common/Version.class\\E"},
{"pattern":"\\Qdubbo.properties\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/RemotingException.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/Transporters.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/exchange/Exchangers.class\\E"},
{"pattern":"\\Qorg/slf4j/impl/StaticLoggerBinder.class\\E"}
]},
"includes":[
{"pattern":"\\QDENY_CLASS\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.compiler.Compiler\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.config.configcenter.DynamicConfigurationFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.context.ApplicationExt\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.context.ModuleExt\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.extension.ExtensionInjector\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.infra.InfraAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.logger.LoggerAdapter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.serialize.hessian2.dubbo.Hessian2FactoryInitializer\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.ThreadPool\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.threadpool.manager.ExecutorRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.common.url.component.param.DynamicParamSource\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.MetadataServiceExporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.ServiceNameMapping\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.WritableMetadataService\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.AddressListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.ProviderFirstParams\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.RegistryClusterIdentifier\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceInstanceCustomizer\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.client.migration.MigrationAddressComparator\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Codec2\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Dispatcher\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.Transporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.exchange.Exchanger\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Filter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.InvokerListener\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.Protocol\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.ProxyFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.Cluster\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.ConfiguratorFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.LoadBalance\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.ProviderURLMergeProcessor\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.RouterFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.ClusterFilter\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.governance.GovernanceRuleRepository\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.model.BuiltinServiceDetector\\E"},
{"pattern":"\\QMETA-INF/dubbo/internal/org.apache.dubbo.rpc.model.ScopeModelInitializer\\E"},
{"pattern":"\\QMETA-INF/services/org.apache.dubbo.common.extension.LoadingStrategy\\E"},
{"pattern":"\\Qdubbo.properties\\E"},
{"pattern":"\\Qlog4j.properties\\E"},
{"pattern":"\\Qorg/apache/dubbo/common/Version.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/RemotingException.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/Transporters.class\\E"},
{"pattern":"\\Qorg/apache/dubbo/remoting/exchange/Exchangers.class\\E"}
]},
"bundles":[]
}

View File

@ -18,9 +18,6 @@ package org.apache.dubbo.common.serialize;
import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;
public class Serialization$Adaptive implements org.apache.dubbo.common.serialize.Serialization {
public java.lang.String getContentType() {
throw new UnsupportedOperationException("The method public abstract java.lang.String org.apache.dubbo.common.serialize.Serialization.getContentType() of interface org.apache.dubbo.common.serialize.Serialization is not adaptive method!");
}
public byte getContentTypeId() {
throw new UnsupportedOperationException("The method public abstract byte org.apache.dubbo.common.serialize.Serialization.getContentTypeId() of interface org.apache.dubbo.common.serialize.Serialization is not adaptive method!");
}
@ -42,4 +39,7 @@ ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(), org.apa
org.apache.dubbo.common.serialize.Serialization extension = (org.apache.dubbo.common.serialize.Serialization)scopeModel.getExtensionLoader(org.apache.dubbo.common.serialize.Serialization.class).getExtension(extName);
return extension.deserialize(arg0, arg1);
}
public java.lang.String getContentType() {
throw new UnsupportedOperationException("The method public abstract java.lang.String org.apache.dubbo.common.serialize.Serialization.getContentType() of interface org.apache.dubbo.common.serialize.Serialization is not adaptive method!");
}
}

View File

@ -18,12 +18,6 @@ package org.apache.dubbo.rpc;
import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;
public class Protocol$Adaptive implements org.apache.dubbo.rpc.Protocol {
public void destroy() {
throw new UnsupportedOperationException("The method public abstract void org.apache.dubbo.rpc.Protocol.destroy() of interface org.apache.dubbo.rpc.Protocol is not adaptive method!");
}
public int getDefaultPort() {
throw new UnsupportedOperationException("The method public abstract int org.apache.dubbo.rpc.Protocol.getDefaultPort() of interface org.apache.dubbo.rpc.Protocol is not adaptive method!");
}
public org.apache.dubbo.rpc.Exporter export(org.apache.dubbo.rpc.Invoker arg0) throws org.apache.dubbo.rpc.RpcException {
if (arg0 == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker argument == null");
if (arg0.getUrl() == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker argument getUrl() == null");
@ -46,4 +40,10 @@ return extension.refer(arg0, arg1);
public java.util.List getServers() {
throw new UnsupportedOperationException("The method public default java.util.List org.apache.dubbo.rpc.Protocol.getServers() of interface org.apache.dubbo.rpc.Protocol is not adaptive method!");
}
public void destroy() {
throw new UnsupportedOperationException("The method public abstract void org.apache.dubbo.rpc.Protocol.destroy() of interface org.apache.dubbo.rpc.Protocol is not adaptive method!");
}
public int getDefaultPort() {
throw new UnsupportedOperationException("The method public abstract int org.apache.dubbo.rpc.Protocol.getDefaultPort() of interface org.apache.dubbo.rpc.Protocol is not adaptive method!");
}
}

View File

@ -18,15 +18,14 @@ package org.apache.dubbo.rpc;
import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;
public class ProxyFactory$Adaptive implements org.apache.dubbo.rpc.ProxyFactory {
public java.lang.Object getProxy(org.apache.dubbo.rpc.Invoker arg0) throws org.apache.dubbo.rpc.RpcException {
if (arg0 == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker argument == null");
if (arg0.getUrl() == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker argument getUrl() == null");
org.apache.dubbo.common.URL url = arg0.getUrl();
public org.apache.dubbo.rpc.Invoker getInvoker(java.lang.Object arg0, java.lang.Class arg1, org.apache.dubbo.common.URL arg2) throws org.apache.dubbo.rpc.RpcException {
if (arg2 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg2;
String extName = url.getParameter("proxy", "javassist");
if(extName == null) throw new IllegalStateException("Failed to get extension (org.apache.dubbo.rpc.ProxyFactory) name from url (" + url.toString() + ") use keys([proxy])");
ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(), org.apache.dubbo.rpc.ProxyFactory.class);
org.apache.dubbo.rpc.ProxyFactory extension = (org.apache.dubbo.rpc.ProxyFactory)scopeModel.getExtensionLoader(org.apache.dubbo.rpc.ProxyFactory.class).getExtension(extName);
return extension.getProxy(arg0);
return extension.getInvoker(arg0, arg1, arg2);
}
public java.lang.Object getProxy(org.apache.dubbo.rpc.Invoker arg0, boolean arg1) throws org.apache.dubbo.rpc.RpcException {
if (arg0 == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker argument == null");
@ -38,13 +37,14 @@ ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(), org.apa
org.apache.dubbo.rpc.ProxyFactory extension = (org.apache.dubbo.rpc.ProxyFactory)scopeModel.getExtensionLoader(org.apache.dubbo.rpc.ProxyFactory.class).getExtension(extName);
return extension.getProxy(arg0, arg1);
}
public org.apache.dubbo.rpc.Invoker getInvoker(java.lang.Object arg0, java.lang.Class arg1, org.apache.dubbo.common.URL arg2) throws org.apache.dubbo.rpc.RpcException {
if (arg2 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg2;
public java.lang.Object getProxy(org.apache.dubbo.rpc.Invoker arg0) throws org.apache.dubbo.rpc.RpcException {
if (arg0 == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker argument == null");
if (arg0.getUrl() == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker argument getUrl() == null");
org.apache.dubbo.common.URL url = arg0.getUrl();
String extName = url.getParameter("proxy", "javassist");
if(extName == null) throw new IllegalStateException("Failed to get extension (org.apache.dubbo.rpc.ProxyFactory) name from url (" + url.toString() + ") use keys([proxy])");
ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(), org.apache.dubbo.rpc.ProxyFactory.class);
org.apache.dubbo.rpc.ProxyFactory extension = (org.apache.dubbo.rpc.ProxyFactory)scopeModel.getExtensionLoader(org.apache.dubbo.rpc.ProxyFactory.class).getExtension(extName);
return extension.getInvoker(arg0, arg1, arg2);
return extension.getProxy(arg0);
}
}

View File

@ -18,8 +18,13 @@ package org.apache.dubbo.rpc.cluster;
import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;
public class Cluster$Adaptive implements org.apache.dubbo.rpc.cluster.Cluster {
@Override
public org.apache.dubbo.rpc.Invoker join(org.apache.dubbo.rpc.cluster.Directory arg0, boolean buildFilterChain) throws org.apache.dubbo.rpc.RpcException {
public org.apache.dubbo.rpc.cluster.Cluster getCluster(org.apache.dubbo.rpc.model.ScopeModel arg0, java.lang.String arg1) {
throw new UnsupportedOperationException("The method public static org.apache.dubbo.rpc.cluster.Cluster org.apache.dubbo.rpc.cluster.Cluster.getCluster(org.apache.dubbo.rpc.model.ScopeModel,java.lang.String) of interface org.apache.dubbo.rpc.cluster.Cluster is not adaptive method!");
}
public org.apache.dubbo.rpc.cluster.Cluster getCluster(org.apache.dubbo.rpc.model.ScopeModel arg0, java.lang.String arg1, boolean arg2) {
throw new UnsupportedOperationException("The method public static org.apache.dubbo.rpc.cluster.Cluster org.apache.dubbo.rpc.cluster.Cluster.getCluster(org.apache.dubbo.rpc.model.ScopeModel,java.lang.String,boolean) of interface org.apache.dubbo.rpc.cluster.Cluster is not adaptive method!");
}
public org.apache.dubbo.rpc.Invoker join(org.apache.dubbo.rpc.cluster.Directory arg0, boolean arg1) throws org.apache.dubbo.rpc.RpcException {
if (arg0 == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.cluster.Directory argument == null");
if (arg0.getUrl() == null) throw new IllegalArgumentException("org.apache.dubbo.rpc.cluster.Directory argument getUrl() == null");
org.apache.dubbo.common.URL url = arg0.getUrl();
@ -27,12 +32,6 @@ String extName = url.getParameter("cluster", "failover");
if(extName == null) throw new IllegalStateException("Failed to get extension (org.apache.dubbo.rpc.cluster.Cluster) name from url (" + url.toString() + ") use keys([cluster])");
ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(), org.apache.dubbo.rpc.cluster.Cluster.class);
org.apache.dubbo.rpc.cluster.Cluster extension = (org.apache.dubbo.rpc.cluster.Cluster)scopeModel.getExtensionLoader(org.apache.dubbo.rpc.cluster.Cluster.class).getExtension(extName);
return extension.join(arg0, buildFilterChain);
}
public org.apache.dubbo.rpc.cluster.Cluster getCluster(java.lang.String arg0) {
throw new UnsupportedOperationException("The method public static org.apache.dubbo.rpc.cluster.Cluster org.apache.dubbo.rpc.cluster.Cluster.getCluster(java.lang.String) of interface org.apache.dubbo.rpc.cluster.Cluster is not adaptive method!");
}
public org.apache.dubbo.rpc.cluster.Cluster getCluster(java.lang.String arg0, boolean arg1) {
throw new UnsupportedOperationException("The method public static org.apache.dubbo.rpc.cluster.Cluster org.apache.dubbo.rpc.cluster.Cluster.getCluster(java.lang.String,boolean) of interface org.apache.dubbo.rpc.cluster.Cluster is not adaptive method!");
return extension.join(arg0, arg1);
}
}

View File

@ -0,0 +1,30 @@
# 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.
# Create graalvm environment for running dubbo native projects
FROM maven:3-jdk-11-slim
WORKDIR /opt
RUN apt-get update \
&& apt-get install -y gcc zlib1g-dev libstdc++-10-dev \
&& curl -L -o /opt/graalvm-ce.tar.gz "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz" \
&& tar -xf graalvm-ce.tar.gz \
&& /opt/graalvm-ce-java11-21.1.0/bin/gu install native-image \
&& rm graalvm-ce.tar.gz
ENV PATH=/opt/graalvm-ce-java11-21.1.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV JAVA_HOME=/opt/graalvm-ce-java11-21.1.0