This closes #1260
This commit is contained in:
commit
ab6806c38b
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue