virajjasani commented on a change in pull request #1652:
URL: https://github.com/apache/hbase/pull/1652#discussion_r419867480
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java
##########
@@ -219,4 +222,18 @@ public void
preExecuteProcedures(ObserverContext<RegionServerCoprocessorEnvironm
// the systemuser nor the superuser so we can not call
executeProcedures...
}
}
+
+ protected static int getFreePort() throws IOException {
+ ServerSocket s = new ServerSocket(0);
+ try {
Review comment:
Good to use try-with-resources and simplify this to:
```
protected static int getFreePort() throws IOException {
try (ServerSocket s = new ServerSocket(0)) {
s.setReuseAddress(true);
return s.getLocalPort();
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]