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



##########
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 try to make this work with OpenJ9.
   
   sorry, if my explanation was is not good.
   Indeed this works for me with OpenJ9. I just found that in order to log this 
message on OpenJ9 "requires static jdk.management" is necessary and we already 
have that, so there is no problem.
   




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