You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/08/29 22:43:47 UTC

[activemq-artemis] 01/03: ARTEMIS-2424 Add option to override isReachable()

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

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 90e4384a4133915ab164724a25f1d756c9b48ce4
Author: Tom <to...@localhost.localdomain>
AuthorDate: Thu Aug 29 10:59:16 2019 -0400

    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).
---
 .../org/apache/activemq/artemis/core/server/NetworkHealthCheck.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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