Thread.sleep(CHECK_FOR_STOP_DELAY);
} catch (InterruptedException e) {
// ignore the interruption itself
- // Do not propagate the isInterrupted flag with : Thread.currentThread().interrupt();
+ // Do not propagate the isInterrupted flag with Thread.currentThread().interrupt()
// It will break the shutdown of ComputeEngineContainerImpl#stop()
}
}
import static org.sonar.process.cluster.ClusterObjectKeys.SONARQUBE_VERSION;
public class HazelcastCluster implements AutoCloseable {
- private static Logger LOGGER = LoggerFactory.getLogger(HazelcastCluster.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastCluster.class);
private final List<AppStateListener> listeners = new ArrayList<>();
private final ReplicatedMap<ClusterProcess, Boolean> operationalProcesses;
nodeAttributes.put("Request Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.REQUEST).getEstimated()));
nodeAttributes.put("Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes()));
nodeAttributes.put("Request Cache Memory", byteCountToDisplaySize(stats.getIndices().getRequestCache().getMemorySizeInBytes()));
- nodeAttributes.put("Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes()));
}
return nodes;
}
RuleKey customRuleKey = RuleKey.of(templateRule.getRepositoryKey(), newRule.ruleKey());
- loadRule(customRuleKey, dbSession)
- .map(existingRule -> updateExistingRule(existingRule, newRule, dbSession))
- .orElseGet(() -> createCustomRule(customRuleKey, newRule, templateRule, dbSession));
+ Optional<RuleDefinitionDto> definition = loadRule(customRuleKey, dbSession);
+ if (definition.isPresent()) {
+ updateExistingRule(definition.get(), newRule, dbSession);
+ } else {
+ createCustomRule(customRuleKey, newRule, templateRule, dbSession);
+ }
ruleIndexer.commitAndIndex(dbSession, customRuleKey);
return customRuleKey;