DomGarguilo commented on code in PR #6080:
URL: https://github.com/apache/accumulo/pull/6080#discussion_r2738059401
##########
server/manager/src/main/java/org/apache/accumulo/manager/metrics/ManagerMetrics.java:
##########
@@ -53,6 +55,24 @@ public class ManagerMetrics implements MetricsProducer {
private final AtomicLong metadataTGWErrorsGauge = new AtomicLong(0);
private final AtomicLong userTGWErrorsGauge = new AtomicLong(0);
private final AtomicInteger compactionConfigurationError = new
AtomicInteger(0);
+ private final AtomicInteger goalState = new AtomicInteger(0);
+
+ public void updateManagerGoalState(ManagerGoalState goal) {
+ switch (goal) {
+ case CLEAN_STOP:
+ goalState.set(0);
+ break;
+ case NORMAL:
+ goalState.set(2);
+ break;
+ case SAFE_MODE:
+ goalState.set(1);
+ break;
+ default:
+ goalState.set(-1);
+ throw new IllegalStateException("Unhandled manager goal state: " +
goal);
+ }
+ }
Review Comment:
It will just be -1 before the first .set() call. With the new switch
expression (as opposed to switch statement) we get compile time checks that the
switch is exhaustive for the enum so there will not be a default case. So this
functions the same as before, a NPE is thrown on null, -1 is only set before
the first `managerGoalState.set()` call, and the default case is never expected
to happen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]