Github user jinmeiliao commented on a diff in the pull request: https://github.com/apache/geode/pull/317#discussion_r92666840 --- Diff: geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java --- @@ -85,21 +91,16 @@ public void connect(String... options) throws Exception { // javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no // such object in table]" Exception. // Tried to wait on jmx connector server being ready, but it doesn't work. - // Add the retry logic here to try at most 10 times for connection. - CommandResult result = null; - for (int i = 0; i < 50; i++) { - System.out.println("trying to connect, attempt " + i); + Awaitility.await().atMost(2, TimeUnit.MINUTES).pollDelay(2, TimeUnit.SECONDS).until(() -> { gfsh.executeCommand(connectCommand.toString()); - result = (CommandResult) gfsh.getResult(); - System.out.println(gfsh.outputString); - if (!gfsh.outputString.contains("no such object in table")) { - break; - } - Thread.currentThread().sleep(2000); - } + return !gfsh.outputString.contains("no such object in table"); + }); + + CommandResult result = (CommandResult) gfsh.getResult(); --- End diff -- the getResult call needs to be inside the awaitility loop. The result is put in a queue everytime a command is called. If you only call it outside the loop, the result you got is the first command result in the loop.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---