ARTEMIS-2424 Add option to override isReachable()

Added check for non default ping command(s)
Bypass InetAddress.isReachable() to allow exclusive use of user defined
ping command(S).
This commit is contained in:
Tom 2019-08-29 10:59:16 -04:00 committed by Clebert Suconic
parent 84c4c2a754
commit 90e4384a41
1 changed files with 5 additions and 1 deletions

View File

@ -331,7 +331,7 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
} }
try { try {
if (address.isReachable(networkInterface, 0, networkTimeout)) { if (!hasCustomPingCommand() && address.isReachable(networkInterface, 0, networkTimeout)) {
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
logger.tracef(address + " OK"); logger.tracef(address + " OK");
} }
@ -415,4 +415,8 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
public boolean isEmpty() { public boolean isEmpty() {
return addresses.isEmpty() && urls.isEmpty(); return addresses.isEmpty() && urls.isEmpty();
} }
public boolean hasCustomPingCommand() {
return !getIpv4Command().equals(IPV4_DEFAULT_COMMAND) || !getIpv6Command().equals(IPV6_DEFAULT_COMMAND);
}
} }