Github user vvysotskyi commented on a diff in the pull request:
https://github.com/apache/drill/pull/1142#discussion_r171620225
--- Diff:
contrib/storage-opentsdb/src/test/java/org/apache/drill/store/openTSDB/TestOpenTSDBPlugin.java
---
@@ -185,4 +188,26 @@ public void testDescribe() throws Exception {
test("describe `warp.speed.test`");
Assert.assertEquals(1, testSql("show tables"));
}
+
+ /**
+ * Checks that port with specified number is free and returns it.
+ * Otherwise, increases port number and checks until free port is found
+ * or the number of attempts is reached specified numAttempts
+ *
+ * @param portNum initial port number
+ * @param numAttempts max number of attempts to find port with greater
number
+ * @return free port number
+ * @throws BindException if free port was not found and all attempts
were used.
+ */
+ private static int getFreePortNum(int portNum, int numAttempts) throws
IOException {
+ while (numAttempts > 0) {
--- End diff --
1. Thanks, it looks better with for loop.
2. Added more details to the error message.
---