This commit is contained in:
Clebert Suconic 2017-05-09 16:40:54 -04:00
commit ab6806c38b
2 changed files with 13 additions and 7 deletions

View File

@ -298,25 +298,27 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
}
/**
* @return true if no checks were done or if one address/url responds; false if all addresses/urls fail
*/
public boolean check() {
boolean isEmpty = true;
if (isEmpty()) {
return true;
}
for (InetAddress address : addresses) {
isEmpty = false;
if (check(address)) {
return true;
}
}
for (URL url : urls) {
isEmpty = false;
if (check(url)) {
return true;
}
}
// This should return true if no checks were done, on this case it's empty
// This is tested by {@link NetworkHe
return isEmpty;
return false;
}
public boolean check(InetAddress address) {
@ -397,4 +399,8 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
return false;
}
}
public boolean isEmpty() {
return addresses.isEmpty() && urls.isEmpty();
}
}

View File

@ -108,7 +108,7 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
signal = BACKUP_ACTIVATION.FAIL_OVER;
}
if (networkHealthCheck != null && networkHealthCheck.check()) {
if (networkHealthCheck != null && !networkHealthCheck.isEmpty() && networkHealthCheck.check()) {
// live is assumed to be down, backup fails-over
signal = BACKUP_ACTIVATION.FAIL_OVER;
} else {