diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java index ff9b89e90a..04c86c4122 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java @@ -52,7 +52,7 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent { public static final String IPV6_DEFAULT_COMMAND = "ping6 -c 1 %2$s"; - public static final String IPV4_DEFAULT_COMMAND = Env.isMacOs() ? "ping -c 1 -t %d %s" : Env.isLinuxOs() ? "ping -c 1 -w %d %s" : "ping -n 1 -w %d %s"; + public static final String IPV4_DEFAULT_COMMAND = Env.isMacOs() ? "ping -c 1 -t %d %s" : Env.isWindowsOs() ? "ping -n 1 -w %d %s | findstr /i TTL" : "ping -c 1 -w %d %s"; private String ipv4Command = IPV4_DEFAULT_COMMAND; diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java index a10424b14b..315d156985 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java @@ -62,6 +62,7 @@ public final class Env { private static final String OS = System.getProperty("os.name").toLowerCase(); private static final boolean IS_LINUX = OS.startsWith("linux"); private static final boolean IS_MAC = OS.startsWith("mac"); + private static final boolean IS_WINDOWS = OS.startsWith("windows"); private Env() { @@ -91,4 +92,7 @@ public final class Env { return IS_MAC == true; } + public static boolean isWindowsOs() { + return IS_WINDOWS == true; + } }