<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.3</li>
<li>Operating System version: macOs Sierra</li>
<li>Java version: Jdk 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>start two provider (A and B)</li>
<li>start one consumer with lazy connection</li>
<li>pull out A provider<br>
The old invoker will be destroyed, including the connection. ReferenceCountExchangeClient will replace a new lazy connection with LAZY_CONNECT_INITIAL_STATE_KEY=false.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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(&quot;warning&quot;, Boolean.TRUE.toString())
                .addParameter(LazyConnectExchangeClient.REQUEST_WITH_WARNING_KEY, true)
                .addParameter(&quot;_client_memo&quot;, &quot;referencecounthandler.replacewithlazyclient&quot;)
                .build();"><pre class="notranslate"><code class="notranslate">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();
</code></pre></div>
<ol start="4" dir="auto">
<li>pull in A provider<br>
DubboProtocol will get shared clients for A provider. And the checkClientCanUse returns available after PR: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="542022248" data-permission-text="Title is private" data-url="https://github.com/apache/dubbo/issues/5531" data-hovercard-type="issue" data-hovercard-url="/apache/dubbo/issues/5531/hovercard" href="https://github.com/apache/dubbo/issues/5531">#5531</a> , which caused invokers returns not avilable as LAZY_CONNECT_INITIAL_STATE_KEY be replaced to FALSE.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private List&lt;ReferenceCountExchangeClient&gt; getSharedClient(URL url, int connectNum) {
        String key = url.getAddress();
        List&lt;ReferenceCountExchangeClient&gt; clients = referenceClientMap.get(key);

        if (checkClientCanUse(clients)) {
            batchClientRefIncr(clients);
            return clients;
        }"><pre class="notranslate"><code class="notranslate">private List&lt;ReferenceCountExchangeClient&gt; getSharedClient(URL url, int connectNum) {
        String key = url.getAddress();
        List&lt;ReferenceCountExchangeClient&gt; clients = referenceClientMap.get(key);

        if (checkClientCanUse(clients)) {
            batchClientRefIncr(clients);
            return clients;
        }
</code></pre></div>
<p dir="auto">ReferenceConfig createProxy will throw exception, as the connection is not available.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="if (shouldCheck() &amp;&amp; !invoker.isAvailable()) {
            throw new IllegalStateException(&quot;Failed to check the status of the service &quot;
}"><pre class="notranslate"><code class="notranslate">if (shouldCheck() &amp;&amp; !invoker.isAvailable()) {
            throw new IllegalStateException("Failed to check the status of the service "
}
</code></pre></div>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">Replaced connection should be avilable.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">Replaced connection is not avilable.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.6</li>
<li>Operating System version: win10</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>IDEA配置dubbo新标签会提示错误</li>
<li>使用xml配置多注册中心后，preferred="true"无效，消费者还是会调用俩个注册中心的服务。</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<p dir="auto">我的配置如下：<br>
俩个提供者分别在俩个项目中。</p>

<p dir="auto"></p>
<p dir="auto">provider1：<br>
<br>
&lt;dubbo:registry id="local" protocol="zookeeper"<br>
address="${dubbo.registry.address.local}" client="curator"<br>
group="${dubbo.registry.group.local}" default="false" zone="local" simplified="true"/&gt;<br>
&lt;dubbo:config-center<br>
address="${dubbo.config-center.address}" group="${dubbo.config-center.group}"/&gt;<br>
&lt;dubbo:metadata-report<br>
address="${dubbo.metadata-report.address}" group="${dubbo.metadata-report.group}"/&gt;<br>
&lt;dubbo:service<br>
interface="com.demo.service.DemoService"<br>
ref="demoServiceImpl" version="2.1.0" registry="local"/&gt;</p>
<p dir="auto">provider2：<br>
<br>
&lt;dubbo:registry id="zookeeper" protocol="zookeeper"<br>
address="${dubbo.registry.address}" client="curator"<br>
group="${dubbo.registry.group}" zone="zookeeper" simplified="true"/&gt;<br>
&lt;dubbo:config-center<br>
address="${dubbo.config-center.address}" group="${dubbo.config-center.group}"/&gt;<br>
&lt;dubbo:metadata-report<br>
address="${dubbo.metadata-report.address}" group="${dubbo.metadata-report.group}"/&gt;<br>
&lt;dubbo:service<br>
interface="com.demo.service.DemoService"<br>
ref="demoServiceImpl" version="2.1.0" registry="zookeeper"/&gt;</p>
<p dir="auto">consumer：<br>
&lt;dubbo:registry id="local" protocol="zookeeper"<br>
address="${dubbo.registry.address.local}" client="curator"<br>
group="${dubbo.registry.group.local}" preferred="true"  zone="local" /&gt;<br>
&lt;dubbo:registry id="zookeeper" protocol="zookeeper"<br>
address="${dubbo.registry.address}" client="curator"<br>
group="${dubbo.registry.group}" zone="zookeeper" /&gt;<br>
&lt;dubbo:reference id="demoService"<br>
interface="com.demo.service.DemoService"<br>
version="2.1.0" registry="local,zookeeper"  /&gt;</p>
<p dir="auto">按照我上面的配置，消费者应该优先使用local这个注册中心，在local这个注册中心中没有服务URL时，才回去zookeeper这个注册中心去。但是实际效果是，俩个注册中心都会被使用到，preferred="true"这个配置无效。</p>
<p dir="auto">并且我使用IDEA开发软件，<br>
&lt;dubbo:config-center 、&lt;dubbo:metadata-report 、 preferred="true"、zone="local"都会被提醒<br>
Attribute 'preferred' is not allowed to appear in element 'dubbo:registry'.等，但是dubbo.xsd中是有<br>
&lt;xsd:attribute name="preferred" type="xsd:boolean"&gt;<br>
xsd:annotation<br>
xsd:documentation&lt;/xsd:documentation&gt;<br>
&lt;/xsd:annotation&gt;<br>
&lt;/xsd:attribute&gt;<br>
这个配置的。</p>