jbertram commented on a change in pull request #3078: ARTEMIS-2708 JDK bug 
causes missed props reload
URL: https://github.com/apache/activemq-artemis/pull/3078#discussion_r407785265
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java
 ##########
 @@ -137,7 +137,14 @@ private void load(final File source, Properties props) 
throws IOException {
    }
 
    private boolean hasModificationAfter(long reloadTime) {
-      return key.file.lastModified() > reloadTime;
+      /**
+       * A bug in JDK 8/9 (i.e. 
https://bugs.openjdk.java.net/browse/JDK-8177809) causes 
java.io.File.lastModified() to
+       * lose resolution past 1 second. Because of this, the value returned by 
java.io.File.lastModified() can appear to
+       * be smaller than it actually is which can cause the broker to miss 
reloading the properties if the modification
+       * happens close to another "reload" event (e.g. initial loading). In 
order to *not* miss file modifications that
+       * need to be reloaded we artificially inflate the value returned by 
java.io.File.lastModified() by 1 second.
+       */
 
 Review comment:
   No, it won't break. The worst that will happen is that the file might be 
reloaded a few more times than necessary which will take more time relatively 
speaking but really shouldn't be a big deal.

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


With regards,
Apache Git Services

Reply via email to