ARTEMIS-3799 Fix default ping command for Windows
The Windows ping command doesn't fail on destination host unreachable
This commit is contained in:
parent
6a3df6412b
commit
17e318ec4d
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue