Skip to content

Commit

Permalink
[Update] Dubbo cloud native (#5252)
Browse files Browse the repository at this point in the history
* Polish #4542 : [Enhancement] Adapt the Java standard Event/Listener mechanism

* Polish #4541 : [Feature] Add local File System DynamicConfigurationFactory‘s extension

* Polish #4541 : Bugfix

* Polish #4541 : Optimization

* Polish #4541 : Add the compatibility for PollingWatchService on the some platforms

* Polish #4541 : Add delay publish without ThreadPoolExecutor

* Polish #4541 : Refactor the extension name

* Polish #4541 : Add remove ops

* Polish #4541 : Add testable constructor

* Polish #4541 : Add getConfigGroups method

* Polish #4610 : [Refactor] Refactor the bootstrap module

* Polish #4541 : Fix the nulling URL issue

* Polish #4622 : [Refactor] Refactor ConfigManager

* Polish #4622 : [Refactor] Refactor ConfigManager

* Polish #4622 : Support multiple configcenters

* Polish #4671 : ServiceNameMapping will not map the group, version and protocol

* update referenceCount log (#4683)

Add comments to support multiple shared connections

* Polish /#4687 : Remove the duplicated test code in dubbo-config-spring (#4688)

* #4685  修改代码if判断false问题 if (hasException == false)修改成if (!hasException) (#4695)

* Fixed Service annotation method parameters are not in effect (#4598)

* keep demo simple, and switch to use zookeeper as registry center (#4705)

* keep demo simple, and switch to use zookeeper as registry center

* remove comment

* @reference auto-wires the instance of generic interface #4594 (#4677)

* try to shorten maven output to make travis build pass (#4710)

* use CountDownLatch to check zk registry if establish connection (#4589)

* Minor change

* Rename the extension name of WritableMetadataService

* Polish #4759 : [Refactor] Change the signature of methods of MetadataService #4759

* Merge remote-tracking branch 'upstream/master' into dubbo-cloud-native

# Conflicts:
#	dubbo-all/pom.xml
#	dubbo-bom/pom.xml
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
#	dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java
#	dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/DynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-api/src/test/java/org/apache/dubbo/configcenter/mock/MockDynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-consul/src/main/java/org/apache/dubbo/configcenter/consul/ConsulDynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
#	dubbo-configcenter/dubbo-configcenter-nacos/src/main/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java
#	dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
#	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/model/MethodDefinition.java
#	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifier.java
#	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReport.java
#	dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java
#	dubbo-metadata/dubbo-metadata-definition-protobuf/src/main/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilder.java
#	dubbo-metadata/dubbo-metadata-definition-protobuf/src/test/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilderTest.java
#	dubbo-metadata/pom.xml
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
#	dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java
#	dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java
#	dubbo-rpc/dubbo-rpc-xml/src/main/java/org/apache/dubbo/xml/rpc/protocol/xmlrpc/XmlRpcProtocol.java

* Polish #3984 : Add the implementation of Page<ServiceInstance> getInstances(String serviceName, int offset, int pageSize, boolean healthyOnly)

* Code merge

* Fix the cases

* Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native

# Conflicts:
#	dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceProviderBootstrap.java
#	dubbo-metadata/dubbo-metadata-definition-protobuf/pom.xml
#	dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/ServiceOrientedRegistryTest.java
#	dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulServiceDiscoveryFactory.java
#	dubbo-registry/dubbo-registry-etcd3/src/main/java/org/apache/dubbo/registry/etcd/EtcdServiceDiscovery.java

* Refactor ConfigManager

* Refactor ConfigManager

* Resolve the issues on ConfigManager

* Refactor and add test-cases for ConfigManager

* Polish #4774 : [Feature] Dubbo Cloud Native - To Support in Spring

* Polish #4808 : [Feature] Add the registered/unregistered event mechanism ShutdownHook

* Polish #4807 : [Feature] Add the callback mechanism ShutdownHook #4807

* Polish #4813 : [Feature] add Prioritized implementation for ServiceInstanceCustomizer

* Polish #4815 : [Feature] Add the ServiceLoader for Dubbo's services or components

* Polish #4815 : [Feature] Add the ServiceLoader for Dubbo's services or components

* Polish #4813 : [Feature] add Prioritized implementation for ServiceInstanceCustomizer

* Polish #4807 : Add sort implementation

* Refactor

* Refactor

* Polish #4845 : [Feature] Enhance the Event-Publishing feature to original ServiceDiscovery

* Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native

# Conflicts:
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceDiscoveryFactory.java
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java

* Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native

# Conflicts:
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceDiscoveryFactory.java
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java

* Polish #4854 : [Feature] MetadataService supports the Dubbo protocol under auto-increased port

* Polish #4857 : [Enhancement] Sync the Metadata storage type into ApplicationConfig

* Polish #4868 : [Enhancement] Refactor ConfigChangeEvent

* Polish #4868 : [Enhancement] Refactor ConfigChangeEvent

* Polish #4873 : [Feature] Add a conditional EventListener into Event Module

* Polish #4875 : [Feature] Refactor ServiceInstancesChangedListener

* Remove the cycle dependencies

* Remove the cycle dependencies

* Polish #4903 : [Feature] Set source into the BeanDefinition of Dubbo Config

* Polish #4902 : [Feature] Dubbo Cloud Native to Spring XML scenario

* Polish #4713 : Initial the new module and dependencies

* Polish #4690 : AnnotatedBeanDefinitionRegistryUtils#registerBeans can't remove the duplicated bean definitions

* Polish #4690 : AnnotatedBeanDefinitionRegistryUtils#registerBeans can't remove the duplicated bean definitions

* Polish #4690 : AnnotatedBeanDefinitionRegistryUtils#registerBeans can't remove the duplicated bean definitions

* Polish #4910 : [Feature] To suppoort DubboLifecycleComponentApplicationListener in Spring XML scenario

* Polish #4713 : Add Service discovery implementation for Eureka #4713

* Polish #4713 : Add Service registration and discovery implementation for Eureka

* Polish #4713 : Add Service registration and discovery implementation for Eureka

* Polish #4920 : [Refactor] Extract the common implementation for URLs' revision

* Refactor

* Polish #4925 : ServiceDiscovery limits only one ServiceInstancesChangedListener each service

* Polish #4925 : ServiceDiscovery limits only one ServiceInstancesChangedListener each service

* Remove useless classes

* Bugfix & Refactor ServiceDiscoveryRegistry

* Polish #4937 : The calculation of Revision should add the parameters of URL

* Polish #4940 : NacosDynamicConfiguration supports getConfigKeys method

* Polish #4942 : Dubbo Cloud Native supports multiple protcols

* Polish #4944 : [Feature] Simplify The metadata of URL for MetadataService

* Polish #4947 : [Feature] Dubbo Cloud-Native supports the REST call to Non-Dubbo

* Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native

# Conflicts:
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java

* Refactor

* Update JavaDoc

* Polish #4905 : Add test cases for Configuration

* Polish #4905 : Add test cases for AbstractDynamicConfigurationFactory

* Polish #4905 : Add test cases for ConfigChangeType

* Polish #4905 : Add test cases for AbstractDynamicConfiguration

* Polish #4905 : Add test cases for ConfigChangedEvent

* Polish #4905 : Add test cases for ConfigChangedEvent

* Polish #4905 : Add test cases for FileSystemDynamicConfiguration

* Polish #4905 : Add test cases for FileSystemDynamicConfigurationFactory

* Polish #4905 : Enhancement the robustness for FileSystemDynamicConfiguration

* Polish #4905 : Add test cases for AdaptiveClassCodeGenerator

* Polish #4905 : Add test cases for ExtensionLoader

* Polish #4905 : Add test cases for ThrowableAction, ThrowableConsumer, ThrowableFunction

* Polish #4905 : Add test cases for Prioritized

* Polish #4905 : Add test cases for ShutdownHookCallbacks

* Polish #4905 : Add test cases for DubboServiceLoader

* Polish #4981 : Add dubbo-common

* Polish #4907 : Add test cases for DubboServiceDestroyedEvent

* Polish #4907 : Add test cases for DubboShutdownHookRegisteredEvent

* Polish #4907 : Add test cases for DubboShutdownHookUnregisteredEvent

* Polish #4907 : Add test cases for ReferenceConfigDestroyedEvent

* Polish #4907 : Add test cases for ReferenceConfigInitializedEvent

* Polish #4907 : Add test cases for ServiceInstancePortCustomizer

* Polish #4907 : Add test cases for ConfigurableMetadataServiceExporter

* Polish #4907 : bugfix for @EnableDubbo

* Polish #4907 : add test cases for @EnableDubboLifecycle

* Update the version to be 2.7.5

* Polish #5034 : update

* Polish #5034 : Add TypeDefinition builders

* Polish #5034 : Complete TypeDefinition builders

* Polish #5034 : Add ModelUtils

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Refactor

* Polish #5034 : Add Spring Web MVC

* Polish #5034 : Refactor

* Polish #5034 : bug fix

* Polish #5034 : Add test cases

* Polish #5034 : Add test cases
  • Loading branch information
mercyblitz authored Oct 28, 2019
1 parent 3a9f46f commit 289e670
Show file tree
Hide file tree
Showing 108 changed files with 8,511 additions and 66 deletions.
13 changes: 12 additions & 1 deletion dubbo-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.dubbo</groupId>
Expand All @@ -31,11 +32,19 @@
<skip_maven_deploy>false</skip_maven_deploy>
</properties>
<dependencies>

<!-- Java Extension Libs -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand All @@ -44,11 +53,13 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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.convert;

import org.apache.dubbo.common.lang.Prioritized;

import java.util.function.Function;

/**
* An interface converts an source instance of type {@link S} to an target instance of type {@link T}
*
* @param <S> the source type
* @param <T> the target type
* @since 2.7.5
*/
public interface Converter<S, T> extends Function<S, T>, Prioritized {

/**
* Tests whether or not the specified the source type and the target type
*
* @param sourceType the source type
* @param targetType the target type
* @return <code>true</code> if support to convert
*/
default boolean accept(Class<S> sourceType, Class<T> targetType) {
return true;
}

/**
* Converts an source instance of type {@link S} to an target instance of type {@link T}
*
* @param source an source instance of type {@link S}
* @return an target instance of type {@link T}
*/
T convert(S source);

@Override
default T apply(S s) {
return convert(s);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.convert;

/**
* A converter converts a {@link String} value to the target instance of type {@link T}
*
* @param <T> the target type
* @since 2.7.5
*/
public interface StringConverter<T> extends Converter<String, T> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* 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.function;

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;

import static java.lang.Boolean.TRUE;
import static java.util.stream.Stream.of;

/**
* The utilities class for Java {@link Predicate}
*
* @since 2.7.5
*/
public interface Predicates {

Predicate[] EMPTY_ARRAY = new Predicate[0];

/**
* {@link Predicate} always return <code>true</code>
*
* @param <T> the type to test
* @return <code>true</code>
*/
static <T> Predicate<T> alwaysTrue() {
return e -> true;
}

/**
* {@link Predicate} always return <code>false</code>
*
* @param <T> the type to test
* @return <code>false</code>
*/
static <T> Predicate<T> alwaysFalse() {
return e -> false;
}


static <E, T> Predicate<T> map(Function<E, Predicate<T>> function, E element) {
return function.apply(element);
}

//
// static <E, T> Predicate<T> map(Function<E, Predicate<T>> function, E... elements) {
// return and(predicates(function, elements));
// }
//

static <E, T> Predicate<T>[] predicates(Function<E, Predicate<T>> function, E... elements) {
return of(elements)
.map(e -> function.apply(e))
.toArray(Predicate[]::new);
}

static <E, T> Predicate<T>[] predicates(BiFunction<E, T, Predicate<T>> function, T value, E... elements) {
return of(elements)
.map(e -> function.apply(e, value))
.toArray(Predicate[]::new);
}

static <E, T> Predicate<T> predicate(BiFunction<E, T, Predicate<T>> function, T value, E... elements) {
return and(predicates(function, value, elements));
}

/**
* Convert a {@link Function} to {@link Predicate}
*
* @param function a {@link Function}
* @param <T> the type to test
* @return non-null
*/
static <T> Predicate<T> predicate(Function<T, Boolean> function) {
return t -> TRUE.equals(function.apply(t));
}

/**
* a composed predicate that represents a short-circuiting logical AND of {@link Predicate predicates}
*
* @param predicates {@link Predicate predicates}
* @param <T> the type to test
* @return non-null
*/
static <T> Predicate<T> and(Predicate<T>... predicates) {
return of(predicates).reduce((a, b) -> a.and(b)).orElseGet(Predicates::alwaysTrue);
}

/**
* a composed predicate that represents a short-circuiting logical OR of {@link Predicate predicates}
*
* @param predicates {@link Predicate predicates}
* @param <T> the detected type
* @return non-null
*/
static <T> Predicate<T> or(Predicate<T>... predicates) {
return of(predicates).reduce((a, b) -> a.or(b)).orElse(e -> true);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* 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.function;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Stream;

import static java.util.stream.Collectors.toList;
import static java.util.stream.StreamSupport.stream;
import static org.apache.dubbo.common.function.Predicates.and;
import static org.apache.dubbo.common.function.Predicates.or;

/**
* The utilities class for {@link Stream}
*
* @since 2.7.5
*/
public interface Streams {

static <T, S extends Iterable<T>> Stream<T> filterStream(S values, Predicate<T> predicate) {
return stream(values.spliterator(), false).filter(predicate);
}

static <T, S extends Iterable<T>> List<T> filterList(S values, Predicate<T> predicate) {
return filterStream(values, predicate).collect(toList());
}

static <T, S extends Iterable<T>> Set<T> filterSet(S values, Predicate<T> predicate) {
// new Set with insertion order
return filterStream(values, predicate).collect(LinkedHashSet::new, Set::add, Set::addAll);
}

static <T, S extends Iterable<T>> S filter(S values, Predicate<T> predicate) {
final boolean isSet = Set.class.isAssignableFrom(values.getClass());
return (S) (isSet ? filterSet(values, predicate) : filterList(values, predicate));
}

static <T, S extends Iterable<T>> S filterAll(S values, Predicate<T>... predicates) {
return filter(values, and(predicates));
}

static <T, S extends Iterable<T>> S filterAny(S values, Predicate<T>... predicates) {
return filter(values, or(predicates));
}

static <T> T filterFirst(Iterable<T> values, Predicate<T>... predicates) {
return stream(values.spliterator(), false)
.filter(and(predicates))
.findFirst()
.orElse(null);
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import static java.util.Collections.sort;
import static org.apache.dubbo.common.function.ThrowableAction.execute;
import static org.apache.dubbo.common.utils.DubboServiceLoader.load;
import static org.apache.dubbo.common.utils.PrioritizedServiceLoader.load;

/**
* The compose {@link ShutdownHookCallback} class to manipulate one and more {@link ShutdownHookCallback} instances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static java.util.Arrays.asList;
import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableSet;

public class CollectionUtils {

Expand Down Expand Up @@ -217,4 +223,17 @@ public static boolean isNotEmptyMap(Map map) {
return !isEmptyMap(map);
}

/**
* Convert to multiple values to be {@link HashSet}
*
* @param values one or more values
* @param <T> the type of <code>values</code>
* @return read-only {@link HashSet}
*/
public static <T> Set<T> asHashSet(T... values) {
if (values == null || values.length < 1) {
return emptySet();
}
return unmodifiableSet(new HashSet(asList(values)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import static java.util.stream.StreamSupport.stream;

/**
* An extension class of {@link ServiceLoader} to help the ease for use of Dubbo services/components
* An extension class of {@link ServiceLoader} with {@link Prioritized} feature
*
* @see ServiceLoader
* @see Prioritized
* @since 2.7.5
*/
public class DubboServiceLoader {
public interface PrioritizedServiceLoader {

/**
* Load a {@link Stream stream} of services by the specified {@link Class type} and {@link ClassLoader}
Expand All @@ -51,7 +51,7 @@ public static <S> Stream<S> load(Class<S> serviceClass, ClassLoader classLoader)

ClassLoader actualClassLoader = classLoader;
if (actualClassLoader == null) {
actualClassLoader = DubboServiceLoader.class.getClassLoader();
actualClassLoader = PrioritizedServiceLoader.class.getClassLoader();
}

ServiceLoader<S> serviceLoader = ServiceLoader.load(serviceClass, actualClassLoader);
Expand Down
Loading

0 comments on commit 289e670

Please sign in to comment.