<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.5.3</li>
<li>Operating System version: mac</li>
<li>Java version: 1.8.0_202</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>java编码方式重复初始化一个没有服务提供者的consumer</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="while (true) {
            try {

                ReferenceConfig&lt;INoProvider&gt; reference = new ReferenceConfig&lt;&gt;(); // #1
                reference.setApplication(new ApplicationConfig(&quot;first-dubbo-client&quot;)); // #2
                reference.setRegistry(new RegistryConfig(&quot;zookeeper://127.0.0.1:2181&quot;)); // #3
                reference.setInterface(INoProvider.class); // #4
                INoProvider noProvider = reference.get(); // #5
                noProvider.say(); // #6

                Thread.sleep(10);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }"><pre class="notranslate"><code class="notranslate">while (true) {
            try {

                ReferenceConfig&lt;INoProvider&gt; reference = new ReferenceConfig&lt;&gt;(); // #1
                reference.setApplication(new ApplicationConfig("first-dubbo-client")); // #2
                reference.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181")); // #3
                reference.setInterface(INoProvider.class); // #4
                INoProvider noProvider = reference.get(); // #5
                noProvider.say(); // #6

                Thread.sleep(10);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
</code></pre></div>
<p dir="auto">AbstractRegistry方法</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public void register(URL url) {
        if (url == null) {
            throw new IllegalArgumentException(&quot;register url == null&quot;);
        }
        if (logger.isInfoEnabled()){
            logger.info(&quot;Register: &quot; + url);
        }
        registered.add(url);
    }
"><pre class="notranslate"><code class="notranslate">public void register(URL url) {
        if (url == null) {
            throw new IllegalArgumentException("register url == null");
        }
        if (logger.isInfoEnabled()){
            logger.info("Register: " + url);
        }
        registered.add(url);
    }

</code></pre></div>
<p dir="auto">AbstractRegistry内部的registered，subscribed，notified，都有重复添加的情况，因为URL的参数中带有timestamp key，每次的timestamp不同，URL的hashCode()方法并没有排除timestamp，导致能一直重复add</p>
<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/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/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</li>
<li>Operating System version: Window7</li>
<li>Java version: jdk8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>Using the quick start example</li>
<li><a href="https://dubbo.apache.org/en-us/docs/user/quick-start.html" rel="nofollow">https://dubbo.apache.org/en-us/docs/user/quick-start.html</a></li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<p dir="auto">No dependence on zkclient test success</p>
<p dir="auto">What do you expected from the above steps？</p>
<p dir="auto">Test failure<br>
Consumer cannot call provider interface</p>
<p dir="auto">provider start log:<br>
十月 27, 2019 6:36:21 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh<br>
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1e397ed7: startup date [Sun Oct 27 18:36:21 CST 2019]; root of context hierarchy<br>
十月 27, 2019 6:36:21 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions<br>
信息: Loading XML bean definitions from class path resource [provider.xml]<br>
十月 27, 2019 6:36:21 下午 org.apache.dubbo.common.logger.LoggerFactory info<br>
信息: using logger: org.apache.dubbo.common.logger.jcl.JclLoggerAdapter<br>
十月 27, 2019 6:36:22 下午 org.apache.dubbo.config.AbstractConfig info<br>
信息:  [DUBBO] The service ready on spring started. service: com.bessky.demo.DemoService, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:22 下午 org.apache.dubbo.config.AbstractConfig warn<br>
警告:  [DUBBO] There's no valid metadata config found, if you are using the simplified mode of registry url, please make sure you have a metadata address configured properly., dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:22 下午 org.apache.dubbo.config.AbstractConfig info<br>
信息:  [DUBBO] No valid ip found from environment, try to find valid host from DNS., dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:22 下午 org.apache.dubbo.config.AbstractConfig info<br>
信息:  [DUBBO] Export dubbo service com.bessky.demo.DemoService to local registry url : injvm://127.0.0.1/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;bind.ip=192.168.98.1&amp;bind.port=20880&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;qos.enable=false&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:22 下午 org.apache.dubbo.config.AbstractConfig info<br>
信息:  [DUBBO] There's no valid monitor config found, if you want to open monitor statistics for Dubbo, please make sure your monitor is configured properly., dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:22 下午 org.apache.dubbo.config.AbstractConfig info<br>
信息:  [DUBBO] Register dubbo service com.bessky.demo.DemoService url dubbo://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;bind.ip=192.168.98.1&amp;bind.port=20880&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;qos.enable=false&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429 to registry registry://224.5.6.7:1234/org.apache.dubbo.registry.RegistryService?application=hello-world-app&amp;dubbo=2.0.2&amp;pid=8792&amp;qos.enable=false&amp;registry=multicast&amp;release=2.7.4&amp;timestamp=1572172582421, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:22 下午 org.apache.dubbo.qos.protocol.QosProtocolWrapper info<br>
信息:  [DUBBO] qos won't be started because it is disabled. Please check dubbo.application.qos.enable is configured either in system property, dubbo.properties or XML/spring-boot configuration., dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:23 下午 org.apache.dubbo.remoting.transport.AbstractServer info<br>
信息:  [DUBBO] Start NettyServer bind /0.0.0.0:20880, export /192.168.98.1:20880, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:23 下午 org.apache.dubbo.registry.multicast.MulticastRegistry info<br>
信息:  [DUBBO] Register: dubbo://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:23 下午 org.apache.dubbo.registry.multicast.MulticastRegistry info<br>
信息:  [DUBBO] Send multicast message: register dubbo://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429 to /224.5.6.7:1234, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:23 下午 org.apache.dubbo.registry.multicast.MulticastRegistry info<br>
信息:  [DUBBO] Subscribe: provider://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;bind.ip=192.168.98.1&amp;bind.port=20880&amp;category=configurators&amp;check=false&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;qos.enable=false&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:23 下午 org.apache.dubbo.registry.multicast.MulticastRegistry info<br>
信息:  [DUBBO] Send multicast message: subscribe provider://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;bind.ip=192.168.98.1&amp;bind.port=20880&amp;category=configurators&amp;check=false&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;qos.enable=false&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429 to /224.5.6.7:1234, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:23 下午 org.apache.dubbo.registry.multicast.MulticastRegistry info<br>
信息:  [DUBBO] Receive multicast message: register dubbo://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429 from /127.0.0.1:1234, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:23 下午 org.apache.dubbo.registry.multicast.MulticastRegistry info<br>
信息:  [DUBBO] Receive multicast message: subscribe provider://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;bind.ip=192.168.98.1&amp;bind.port=20880&amp;category=configurators&amp;check=false&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;qos.enable=false&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429 from /127.0.0.1:1234, dubbo version: 2.7.4, current host: 192.168.98.1<br>
十月 27, 2019 6:36:24 下午 org.apache.dubbo.registry.multicast.MulticastRegistry warn<br>
警告:  [DUBBO] Ignore empty notify urls for subscribe url provider://192.168.98.1:20880/com.bessky.demo.DemoService?anyhost=true&amp;application=hello-world-app&amp;bean.name=com.bessky.demo.DemoService&amp;bind.ip=192.168.98.1&amp;bind.port=20880&amp;category=configurators&amp;check=false&amp;deprecated=false&amp;dubbo=2.0.2&amp;dynamic=true&amp;generic=false&amp;interface=com.bessky.demo.DemoService&amp;methods=sayHello&amp;pid=8792&amp;qos.enable=false&amp;release=2.7.4&amp;side=provider&amp;timestamp=1572172582429, dubbo version: 2.7.4, current host: 192.168.98.1</p>