zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asdf2014 <...@git.apache.org>
Subject [GitHub] zookeeper pull request #303: ZOOKEEPER-2840: Should using `System.nanoTime()...
Date Mon, 16 Apr 2018 03:02:53 GMT
Github user asdf2014 commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/303#discussion_r181613274
  
    --- Diff: src/java/main/org/apache/zookeeper/client/StaticHostProvider.java ---
    @@ -71,7 +71,7 @@
          *             if serverAddresses is empty or resolves to an empty list
          */
         public StaticHostProvider(Collection<InetSocketAddress> serverAddresses) {
    -       sourceOfRandomness = new Random(System.currentTimeMillis() ^ this.hashCode());
    +       sourceOfRandomness = new Random(System.nanoTime() ^ this.hashCode());
    --- End diff --
    
    Hi, @maoling. Sorry for my belated comment. Indeed, i hadn't been considered this case
that different clients will own different `hashcode`s. Because, in my sistuation, our Zookeeper
clusters only give service to some apointed BigData components, e.g., [HBase](https://yuzhouwan.com/posts/45888/),
[Druid.io](https://yuzhouwan.com/posts/5845/), [Hadoop](https://yuzhouwan.com/posts/60504/),
[Kafka](https://yuzhouwan.com/posts/26002/) etc. Inside these components will have settled
clients, so them can not offer too many different `hashcode`s.


---

Mime
View raw message