ARTEMIS-5042 don't throw Exception when clearing cluster-connection bindings

Throwing an exception when clearing the bindings when a
cluster-connection is closed short-circuits the clearing (and closing)
process. This commit fixes that by simply logging the failure to clear
and continues on.

No new tests are added with this commit. It relies on existing tests.
This commit is contained in:
Justin Bertram 2024-09-20 15:24:57 -05:00 committed by Timothy Bish
parent 9db78f6f59
commit 9bb63b656f
2 changed files with 9 additions and 2 deletions

View File

@ -1621,4 +1621,7 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 224139, value = "Failed to stop bridge: {}", level = LogMessage.Level.ERROR)
void errorStoppingBridge(String bridgeName, Exception e);
@LogMessage(id = 224140, value = "Clearing bindings on cluster-connection {} failed to remove binding {}: {}", level = LogMessage.Level.WARN)
void clusterConnectionFailedToRemoveBindingOnClear(String clusterConnection, String binding, String exceptionMessage);
}

View File

@ -1245,10 +1245,14 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
server.getGroupingHandler().sendProposalResponse(response, hops + 1);
}
private synchronized void clearBindings() throws Exception {
private synchronized void clearBindings() {
logger.debug("{} clearing bindings", ClusterConnectionImpl.this);
for (RemoteQueueBinding binding : new HashSet<>(bindings.values())) {
removeBinding(binding.getClusterName());
try {
removeBinding(binding.getClusterName());
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.clusterConnectionFailedToRemoveBindingOnClear(getName().toString(), binding.getClusterName().toString(), e.getMessage());
}
}
}