michaelandrepearce 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_r407749322
##########
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:
Just a note here wont this break / cause file to be repeatedly reloaded once
the jdk bug is fixed? Is this fixed in 11?
Is it worth adding some check to jdk version? Before doing the workaround so
only do workaround on broken jdk versions
----------------------------------------------------------------
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