uschindler commented on a change in pull request #572:
URL: https://github.com/apache/lucene/pull/572#discussion_r775869802



##########
File path: lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java
##########
@@ -153,6 +154,19 @@ private RamUsageEstimator() {}
         }
       } catch (@SuppressWarnings("unused") ReflectiveOperationException | 
RuntimeException e) {
         isHotspot = false;
+        final Logger log = Logger.getLogger(RamUsageEstimator.class.getName());
+        final Module module = RamUsageEstimator.class.getModule();
+        final ModuleLayer layer = module.getLayer();
+        // classpath / unnamed module has no layer, so we need to check:
+        if (layer != null
+            && 
layer.findModule("jdk.management").map(module::canRead).orElse(false) == false) 
{
+          log.warning(
+              "Lucene cannot correctly calculate object sizes on 64bit JVMs, 
unless the 'jdk.management' Java module "
+                  + "is readable [please add 'jdk.management' to modular 
application either by command line or its module descriptor]");
+        } else {
+          log.warning(
+              "Lucene cannot correctly calculate object sizes on 64bit JVMs 
that are not based on Hotspot.");

Review comment:
       I will do my own checks with J9 later, it is unrelated to this issue. I 
have the feeling we are talking about different things: The code as written 
here works (thanks for clarifying). With my comment I was asking you, if you 
have a quick info about J9 and support for a HotspotMXBean that can be used to 
detect reference size. If not, I will check for an alternative in a separate 
issue.
   
   I will change the message a bit to say "Hotspot or a compatible 
implementation".




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to