adoroszlai commented on code in PR #8207:
URL: https://github.com/apache/ozone/pull/8207#discussion_r2024745850
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReportHandler.java:
##########
@@ -47,16 +47,17 @@ public class ContainerReportHandler extends
AbstractContainerReportHandler
private static final Logger LOG =
LoggerFactory.getLogger(ContainerReportHandler.class);
- private final NodeManager nodeManager;
- private final ContainerManager containerManager;
- private final String unknownContainerHandleAction;
+ enum UnknownContainerAction {
+ WARN, DELETE;
- /**
- * The action taken by ContainerReportHandler to handle
- * unknown containers.
- */
- static final String UNKNOWN_CONTAINER_ACTION_WARN = "WARN";
- static final String UNKNOWN_CONTAINER_ACTION_DELETE = "DELETE";
+ static UnknownContainerAction parse(String s) {
+ return s.equals(WARN.name()) ? WARN
+ : s.equals(DELETE.name()) ? DELETE
+ : null;
+ }
Review Comment:
Should we use built-in `valueOf`? I think throwing exception on invalid
value (which `valueOf` does) is better than silently ignoring it.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]