vinothchandar commented on a change in pull request #2231:
URL: https://github.com/apache/hudi/pull/2231#discussion_r528877708
##########
File path:
hudi-common/src/main/java/org/apache/hudi/common/util/ObjectSizeCalculator.java
##########
@@ -328,54 +328,53 @@ private static long getPrimitiveFieldSize(Class<?> type) {
static MemoryLayoutSpecification getEffectiveMemoryLayoutSpecification() {
final String vmName = System.getProperty("java.vm.name");
if (vmName == null || !(vmName.startsWith("Java HotSpot(TM) ") ||
vmName.startsWith("OpenJDK")
- || vmName.startsWith("TwitterJDK"))) {
- throw new UnsupportedOperationException("ObjectSizeCalculator only
supported on HotSpot VM");
+ || vmName.startsWith("TwitterJDK") || vmName.startsWith("Eclipse
OpenJ9"))) {
+ throw new UnsupportedOperationException("ObjectSizeCalculator only
supported on HotSpot or Eclipse OpenJ9 VMs");
}
- final String dataModel = System.getProperty("sun.arch.data.model");
- if ("32".equals(dataModel)) {
- // Running with 32-bit data model
- return new MemoryLayoutSpecification() {
- @Override
- public int getArrayHeaderSize() {
- return 12;
- }
+ final String strVmVersion = System.getProperty("java.vm.version");
+ // Support for OpenJ9 JVM
+ if (strVmVersion.startsWith("openj9")) {
+ final String dataModel = System.getProperty("sun.arch.data.model");
+ if ("32".equals(dataModel)) {
+ // Running with 32-bit data model
+ return new MemoryLayoutSpecification() {
Review comment:
@guykhazma
>another option is to have class per each combination (hotspot 32 bit,
hotspot 64 bit compressed, hotspot 64 bit non compressed, openj9 32 bit, openj9
64 bit compressed, and openj9 64 bit non compressed)
I was mulling something like this. not even parameterizing by `dataModel`.
Just pulling all anonymous classes that exist now into named classes. So its
easier to maintain. So far, we left this code as-is, given we borrowed it :)
----------------------------------------------------------------
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]