michaelandrepearce commented on a change in pull request #3580:
URL: https://github.com/apache/activemq-artemis/pull/3580#discussion_r632889528



##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
##########
@@ -768,6 +772,45 @@ public void parseMainConfig(final Element e, final 
Configuration config) throws
       }
    }
 
+
+   private void parseJournalRetention(final Element e, final Configuration 
config) {
+      NodeList retention = e.getElementsByTagName("journal-retention");
+
+      if (retention.getLength() != 0) {
+         Element node = (Element) retention.item(0);
+
+         String directory = getAttributeValue(node, "directory");
+         long storageLimit = ByteUtil.convertTextBytes(getAttributeValue(node, 
"storage-limit").trim());
+         int period = getAttributeInteger(node, "period", 0, 
Validators.GT_ZERO);
+         String unitStr = getAttributeValue(node, "unit");
+
+         TimeUnit unit;
+
+         switch (unitStr) {
+            case "DAYS":
+               unit = TimeUnit.DAYS;
+               break;
+            case "HOURS":
+               unit = TimeUnit.HOURS;
+               break;
+            case "MINUTES":
+               unit = TimeUnit.MINUTES;
+               break;
+            case "SECONDS":
+               unit = TimeUnit.SECONDS;
+               break;
+            default:
+               unit = TimeUnit.DAYS;
+         }
+
+         config.setJournalRetentionDirectory(directory);
+         config.setJournalRetentionTimeUnit(unit);

Review comment:
       So that two args throughout code base dont have to deal with time 
conversion and also in more critical code it doesnt have to be converted later 
why not convert to ms at point of config load




-- 
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:
[email protected]


Reply via email to