You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/02/26 17:30:22 UTC

[GitHub] [accumulo] milleruntime commented on a change in pull request #1950: Clean up CompactionDirectives default impl

milleruntime commented on a change in pull request #1950:
URL: https://github.com/apache/accumulo/pull/1950#discussion_r583800951



##########
File path: core/src/main/java/org/apache/accumulo/core/spi/compaction/SimpleCompactionDispatcher.java
##########
@@ -72,19 +72,17 @@
   public void init(InitParameters params) {
     services = new EnumMap<>(CompactionKind.class);
 
-    var defaultService = CompactionDirectives.builder().build();
+    CompactionsDirectiveImpl defaultService = CompactionsDirectiveImpl.DEFAULT;
 
     if (params.getOptions().containsKey("service")) {
-      defaultService =
-          CompactionDirectives.builder().setService(params.getOptions().get("service")).build();
+      defaultService.setService(params.getOptions().get("service"));
     }
 
     for (CompactionKind ctype : CompactionKind.values()) {
       String service = params.getOptions().get("service." + ctype.name().toLowerCase());
-      if (service == null)
-        services.put(ctype, defaultService);
-      else
-        services.put(ctype, CompactionDirectives.builder().setService(service).build());
+      if (service != null)
+        defaultService.setService(service);

Review comment:
       It was not clear to me that this class was immutable, since it contained multiple `setter` methods. I think a POJO with final members set in the constructor would be a lot more clear.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org