openj9
openj9 copied to clipboard
OpenJ9 ignores readOnly option when running listAllCaches
When user running java -Xshareclasses:readOnly,listAllCaches, it is expected the cache files in the cache directory to be opened in read-only mode. Currently OpenJ9 implementation ignores the readOnly option and it is opened in read-write mode.
I would have expected the caches to be opened in read-only mode even if the readOnly option isn't used, I think it should be the default.
By default, there is a header lock that the JVM tries to acquire so that we detect if the cache is currently in use. If no, we will print out the last detach time, If yes, we print out In use under last detach time column. The header lock requires the cache file to be open in read-write mode. If open in read-only mode, we won't report the last detach time.