You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2021/04/12 23:08:47 UTC

[groovy] branch master updated: minor refactor: tweak to make more robust on CI servers

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 2060eae  minor refactor: tweak to make more robust on CI servers
2060eae is described below

commit 2060eae5e997c7075501dbd3a6a9725f677838e7
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Apr 13 09:08:40 2021 +1000

    minor refactor: tweak to make more robust on CI servers
---
 .../src/test/java/groovy/jmx/builder/JmxConnectorHelper.java        | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/subprojects/groovy-jmx/src/test/java/groovy/jmx/builder/JmxConnectorHelper.java b/subprojects/groovy-jmx/src/test/java/groovy/jmx/builder/JmxConnectorHelper.java
index 4e6f904..bb09c8d 100644
--- a/subprojects/groovy-jmx/src/test/java/groovy/jmx/builder/JmxConnectorHelper.java
+++ b/subprojects/groovy-jmx/src/test/java/groovy/jmx/builder/JmxConnectorHelper.java
@@ -29,12 +29,14 @@ import java.util.Map;
  * Helper class to help with RMI
  */
 public class JmxConnectorHelper {
+    private static final int MAX_RETRIES = 10;
+
     public static Map createRmiRegistry(int initPort) {
         Map<String, Object> result = new HashMap<String, Object>(2);
         int counter = 0;
         int port = initPort;
         Registry reg = null;
-        while (reg == null && counter <= 4) {
+        while (reg == null && counter <= MAX_RETRIES) {
             try {
                 reg = LocateRegistry.createRegistry(port);
                 result.put("registry", reg);
@@ -45,7 +47,7 @@ public class JmxConnectorHelper {
                 port = port + 1;
                 System.out.println("JmxBuilder - *** FAILED *** to create RMI Registry - Will Retry on port [" + port + "].");
                 try {
-                    Thread.sleep(500);
+                    Thread.sleep(100L * counter);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
                 }