Issue 1:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.3

Operating System version: macOs Sierra

Java version: Jdk 1.8

Steps to reproduce this issue

start two provider (A and B)

start one consumer with lazy connection

pull out A provider

The old invoker will be destroyed, including the connection. ReferenceCountExchangeClient will replace a new lazy connection with LAZY_CONNECT_INITIAL_STATE_KEY=false.

private void replaceWithLazyClient() {
URL lazyUrl = URLBuilder.from(url)
.addParameter(LAZY_CONNECT_INITIAL_STATE_KEY, Boolean.FALSE)
.addParameter(RECONNECT_KEY, Boolean.FALSE)
.addParameter(SEND_RECONNECT_KEY, Boolean.TRUE.toString())
.addParameter("warning", Boolean.TRUE.toString())
.addParameter(LazyConnectExchangeClient.REQUEST_WITH_WARNING_KEY, true)
.addParameter("_client_memo", "referencecounthandler.replacewithlazyclient")
.build();

pull in A provider

DubboProtocol will get shared clients for A provider. And the checkClientCanUse returns available after PR: #5531 , which caused invokers returns not avilable as LAZY_CONNECT_INITIAL_STATE_KEY be replaced to FALSE.

private List<ReferenceCountExchangeClient> getSharedClient(URL url, int connectNum) {
String key = url.getAddress();
List<ReferenceCountExchangeClient> clients = referenceClientMap.get(key);

if (checkClientCanUse(clients)) {
batchClientRefIncr(clients);
return clients;
}

ReferenceConfig createProxy will throw exception, as the connection is not available.

if (shouldCheck() && !invoker.isAvailable()) {
throw new IllegalStateException("Failed to check the status of the service "
}

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

Replaced connection should be avilable.

Actual Result

Replaced connection is not avilable.

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.6

Operating System version: win10

Java version: 1.8

Steps to reproduce this issue

IDEA配置dubbo新标签会提示错误

使用xml配置多注册中心后，preferred="true"无效，消费者还是会调用俩个注册中心的服务。

Pls. provide [GitHub address] to reproduce this issue.

我的配置如下：

俩个提供者分别在俩个项目中。

provider1：

<dubbo:registry id="local" protocol="zookeeper"

address="${dubbo.registry.address.local}" client="curator"

group="${dubbo.registry.group.local}" default="false" zone="local" simplified="true"/>

<dubbo:config-center

address="${dubbo.config-center.address}" group="${dubbo.config-center.group}"/>

<dubbo:metadata-report

address="${dubbo.metadata-report.address}" group="${dubbo.metadata-report.group}"/>

<dubbo:service

interface="com.demo.service.DemoService"

ref="demoServiceImpl" version="2.1.0" registry="local"/>

provider2：

<dubbo:registry id="zookeeper" protocol="zookeeper"

address="${dubbo.registry.address}" client="curator"

group="${dubbo.registry.group}" zone="zookeeper" simplified="true"/>

<dubbo:config-center

address="${dubbo.config-center.address}" group="${dubbo.config-center.group}"/>

<dubbo:metadata-report

address="${dubbo.metadata-report.address}" group="${dubbo.metadata-report.group}"/>

<dubbo:service

interface="com.demo.service.DemoService"

ref="demoServiceImpl" version="2.1.0" registry="zookeeper"/>

consumer：

<dubbo:registry id="local" protocol="zookeeper"

address="${dubbo.registry.address.local}" client="curator"

group="${dubbo.registry.group.local}" preferred="true" zone="local" />

<dubbo:registry id="zookeeper" protocol="zookeeper"

address="${dubbo.registry.address}" client="curator"

group="${dubbo.registry.group}" zone="zookeeper" />

<dubbo:reference id="demoService"

interface="com.demo.service.DemoService"

version="2.1.0" registry="local,zookeeper" />

按照我上面的配置，消费者应该优先使用local这个注册中心，在local这个注册中心中没有服务URL时，才回去zookeeper这个注册中心去。但是实际效果是，俩个注册中心都会被使用到，preferred="true"这个配置无效。

并且我使用IDEA开发软件，

<dubbo:config-center 、<dubbo:metadata-report 、 preferred="true"、zone="local"都会被提醒

Attribute 'preferred' is not allowed to appear in element 'dubbo:registry'.等，但是dubbo.xsd中是有

<xsd:attribute name="preferred" type="xsd:boolean">

xsd:annotation

xsd:documentation</xsd:documentation>

</xsd:annotation>

</xsd:attribute>

这个配置的。