HBASE-17869 UnsafeAvailChecker wrongly returns false on ppc

This commit is contained in:
Jerry He 2017-04-06 16:04:47 -07:00
parent a6e9de3a0e
commit b6a2c02b93
1 changed files with 15 additions and 9 deletions

View File

@ -51,6 +51,11 @@ public class UnsafeAvailChecker {
});
// When Unsafe itself is not available/accessible consider unaligned as false.
if (avail) {
String arch = System.getProperty("os.arch");
if ("ppc64".equals(arch) || "ppc64le".equals(arch)) {
// java.nio.Bits.unaligned() wrongly returns false on ppc (JDK-8165231),
unaligned = true;
} else {
try {
// Using java.nio.Bits#unaligned() to check for unaligned-access capability
Class<?> clazz = Class.forName("java.nio.Bits");
@ -63,6 +68,7 @@ public class UnsafeAvailChecker {
}
}
}
}
/**
* @return true when running JVM is having sun's Unsafe package available in it and it is