diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java index c537f03381d..0a18b54a418 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvoker.java @@ -19,6 +19,7 @@ import org.apache.dubbo.common.extension.ExtensionLoader; import org.apache.dubbo.common.logger.Logger; import org.apache.dubbo.common.logger.LoggerFactory; +import org.apache.dubbo.common.utils.CollectionUtils; import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.rpc.Invocation; import org.apache.dubbo.rpc.Invoker; @@ -32,6 +33,7 @@ import org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import static org.apache.dubbo.common.constants.CommonConstants.PREFERRED_KEY; @@ -60,6 +62,12 @@ public ZoneAwareClusterInvoker(Directory directory) { if (loader.hasExtension("default")) { zoneDetector = loader.getExtension("default"); } + if (zoneDetector == null) { + Set zoneDetectors = loader.getSupportedExtensionInstances(); + if (CollectionUtils.isNotEmpty(zoneDetectors)) { + zoneDetector = zoneDetectors.iterator().next(); + } + } } @Override