<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/incubator-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"> I have checked the <a href="https://github.com/apache/incubator-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.6.2</li>
<li>Operating System version: win7</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Step to reproduce this issue</h3>
<ol dir="auto">
<li>在本机启动了一个provider, accepts参数设置的为1：<br>
java -Ddubbo.protocol.port=12345 -Dserver.port=9090 -Dmanagement.server.port=9091 -Ddubbo.application.qos-port=22221 -Ddubbo.protocol.accepts=1 -jar dubbo-demo-provider\target\dubbo-provider-1.0-SNAPSHOT.jar</li>
<li>在本机启动了两个consumer:<br>
java -Dserver.port=8080 -Dmanagement.server.port=8081 -Ddubbo.registry.file=xxx.properties  -jar dubbo-demo-consumer\target\dubbo-consumer-1.0-SNAPSHOT.jar<br>
java -Dserver.port=8084 -Dmanagement.server.port=8085 -Ddubbo.registry.file=yyy.properties  -jar dubbo-demo-consumer\target\dubbo-consumer-1.0-SNAPSHOT.jar<br>
第二个启动的consumer会正常被accepts=1给断开连接。</li>
<li>然后我在admin中动态修改配置,将accepts改为2<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/16410900/44095585-c6213462-a00b-11e8-9175-1352b298b4cb.png"><img src="https://user-images.githubusercontent.com/16410900/44095585-c6213462-a00b-11e8-9175-1352b298b4cb.png" alt="image" style="max-width: 100%;"></a><br>
发现第二个启动的consumer可以正常连接，没问题<br>
4.在admin页面中，将accepts再次修改成1,发现两个consumer仍然会正常连接，理论上是要有一个被踢下线的才对。</li>
</ol>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">期望只有一个consumer连接，另外一个consumer会由于超过accepts数而拒绝连接</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">两个consumer都正常连接着，并能够正常对外提供服务</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.4-SNAPSHOT</li>
<li>Operating System version: macOS10.12.6</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">主要是配合dubbo admin的时候，如果意外删除了接口目录，导致之后该接口的实例将不再被发现</p>
<ol dir="auto">
<li>启动dubbo-admin</li>
<li>启动dubbo生产者，此时dubbo-admin有该生产者记录</li>
<li>关闭生产者，并且删除该生产者的接口目录</li>
<li>重启生产者，将不会在dubbo-admin上看到相关记录</li>
</ol>
<p dir="auto">主要原因是以下回调对anyServices只有add操作，没有delete操作，导致下一次目录变化时，也不会进入if中进行订阅新增接口。</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" listeners.putIfAbsent(listener, (parentPath, currentChilds) -&gt; {
                        for (String child : currentChilds) {
                            child = URL.decode(child);
                            if (!anyServices.contains(child)) {
                                anyServices.add(child);
                                subscribe(url.setPath(child).addParameters(INTERFACE_KEY, child,
                                        Constants.CHECK_KEY, String.valueOf(false)), listener);
                            } 
                    });
"><pre class="notranslate"> <span class="pl-s1">listeners</span>.<span class="pl-en">putIfAbsent</span>(<span class="pl-s1">listener</span>, (<span class="pl-s1">parentPath</span>, <span class="pl-s1">currentChilds</span>) -&gt; {
                        <span class="pl-k">for</span> (<span class="pl-smi">String</span> <span class="pl-s1">child</span> : <span class="pl-s1">currentChilds</span>) {
                            <span class="pl-s1">child</span> = <span class="pl-smi">URL</span>.<span class="pl-en">decode</span>(<span class="pl-s1">child</span>);
                            <span class="pl-k">if</span> (!<span class="pl-s1">anyServices</span>.<span class="pl-en">contains</span>(<span class="pl-s1">child</span>)) {
                                <span class="pl-s1">anyServices</span>.<span class="pl-en">add</span>(<span class="pl-s1">child</span>);
                                <span class="pl-en">subscribe</span>(<span class="pl-s1">url</span>.<span class="pl-en">setPath</span>(<span class="pl-s1">child</span>).<span class="pl-en">addParameters</span>(<span class="pl-c1">INTERFACE_KEY</span>, <span class="pl-s1">child</span>,
                                        <span class="pl-smi">Constants</span>.<span class="pl-c1">CHECK_KEY</span>, <span class="pl-smi">String</span>.<span class="pl-en">valueOf</span>(<span class="pl-c1">false</span>)), <span class="pl-s1">listener</span>);
                            } 
                    });</pre></div>