From: Eric Hartmann Date: Fri, 22 Jun 2018 09:13:26 +0000 (+0200) Subject: SONAR-10922 Silence Hazelcast logs X-Git-Tag: 7.5~909 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ce2b952e387da62818da410e65279245d517a454;p=sonarqube.git SONAR-10922 Silence Hazelcast logs --- diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java index 74cbfa2437e..9880abf5956 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java @@ -19,9 +19,12 @@ */ package org.sonar.ce; +import com.hazelcast.spi.exception.RetryableHazelcastException; import java.util.Map; import java.util.Set; import java.util.concurrent.locks.Lock; +import org.apache.logging.log4j.Logger; +import org.elasticsearch.common.logging.Loggers; import org.picocontainer.Startable; import org.sonar.ce.taskprocessor.CeWorkerFactory; import org.sonar.process.cluster.hz.HazelcastMember; @@ -34,6 +37,8 @@ import static org.sonar.process.cluster.hz.HazelcastObjects.WORKER_UUIDS; * Provide the set of worker's UUID in a clustered SonarQube instance */ public class CeDistributedInformationImpl implements CeDistributedInformation, Startable { + private static final Logger LOGGER = Loggers.getLogger(CeDistributedInformationImpl.class); + private final HazelcastMember hazelcastMember; private final CeWorkerFactory ceCeWorkerFactory; @@ -74,8 +79,12 @@ public class CeDistributedInformationImpl implements CeDistributedInformation, S @Override public void stop() { - // Removing the worker UUIDs - getClusteredWorkerUUIDs().remove(hazelcastMember.getUuid()); + try { + // Removing the worker UUIDs + getClusteredWorkerUUIDs().remove(hazelcastMember.getUuid()); + } catch (RetryableHazelcastException e) { + LOGGER.debug("Unable to remove worker UUID from the list of active workers", e.getMessage()); + } } private Map> getClusteredWorkerUUIDs() { diff --git a/server/sonar-process/src/main/java/org/sonar/process/cluster/health/HealthStateRefresher.java b/server/sonar-process/src/main/java/org/sonar/process/cluster/health/HealthStateRefresher.java index 0204237d072..63416802200 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/cluster/health/HealthStateRefresher.java +++ b/server/sonar-process/src/main/java/org/sonar/process/cluster/health/HealthStateRefresher.java @@ -20,6 +20,7 @@ package org.sonar.process.cluster.health; import com.hazelcast.core.HazelcastInstanceNotActiveException; +import com.hazelcast.spi.exception.RetryableHazelcastException; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,7 +49,7 @@ public class HealthStateRefresher { try { NodeHealth nodeHealth = nodeHealthProvider.get(); sharedHealthState.writeMine(nodeHealth); - } catch (HazelcastInstanceNotActiveException e) { + } catch (HazelcastInstanceNotActiveException | RetryableHazelcastException e) { LOG.debug("Hazelcast is no more active", e); } catch (Throwable t) { LOG.error("An error occurred while attempting to refresh HealthState of the current node in the shared state:", t);