Todd Lipcon has posted comments on this change.

Change subject: [java] KUDU-2103 Canonicalize hostnames in client
......................................................................


Patch Set 3:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/7757/3/java/kudu-client/src/test/java/org/apache/kudu/client/FakeDNS.java
File java/kudu-client/src/test/java/org/apache/kudu/client/FakeDNS.java:

PS3, Line 50:   private Map<String, InetAddress> forwardResolutions = new 
HashMap<>();
            : 
            :   private Map<InetAddress, String> reverseResolutions = new 
HashMap<>();
these should probably be @GuardedBy("this") and have the below suggested 'add' 
methods be synchronized


PS3, Line 54:   public Map<String, InetAddress> getForwardResolutions() {
            :     return forwardResolutions;
            :   }
            : 
            :   public Map<InetAddress, String> getReverseResolutions() {
nit: it's better practice not to return mutable private members like this. I 
think you should be able to get by with just a 'addForwardResolution(String 
host, InetAddress addr)' and the equivalent for reverse resolution


PS3, Line 93:       if (forwardResolutions.containsKey(host)) {
            :         return new InetAddress[]{forwardResolutions.get(host)};
            :       }
nit: to avoid double lookup, restructure as:

InetAddress addr = forwardResolutions.get(host);
if (addr != null) {
  return addr;
}
... throw


PS3, Line 105:       } else if 
(reverseResolutions.containsKey(InetAddress.getByAddress(addr))) {
             :         return 
reverseResolutions.get(InetAddress.getByAddress(addr));
             :  
same. Also no need for the 'else' here since the previous statement returns


http://gerrit.cloudera.org:8080/#/c/7757/3/java/kudu-client/src/test/java/org/apache/kudu/client/TestServerInfo.java
File java/kudu-client/src/test/java/org/apache/kudu/client/TestServerInfo.java:

PS3, Line 49:         InetAddress.getByName("10.1.2.3")
            :     );
does our maven checkstyle plugin think this is OK? seems a bit funny to me, 
would be good to run this patch through checkstyle before committing.


-- 
To view, visit http://gerrit.cloudera.org:8080/7757
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I77204a185c1ab8e21cc833afb645543cbc0e340f
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Attila Bukor <[email protected]>
Gerrit-Reviewer: Attila Bukor <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <[email protected]>
Gerrit-HasComments: Yes

Reply via email to