Class CleanerUtil

java.lang.Object
org.apache.hadoop.util.CleanerUtil

@Private @Unstable public final class CleanerUtil extends Object
sun.misc.Cleaner has moved in OpenJDK 9 and sun.misc.Unsafe#invokeCleaner(ByteBuffer) is the replacement. This class is a hack to use sun.misc.Cleaner in Java 8 and use the replacement in Java 9+. This implementation is inspired by LUCENE-6989.
  • Field Details

    • UNMAP_SUPPORTED

      public static final boolean UNMAP_SUPPORTED
      true, if this platform supports unmapping mmapped files.
    • UNMAP_NOT_SUPPORTED_REASON

      public static final String UNMAP_NOT_SUPPORTED_REASON
      if UNMAP_SUPPORTED is false, this contains the reason why unmapping is not supported.
  • Method Details

    • getCleaner

      public static CleanerUtil.BufferCleaner getCleaner()
      Reference to a BufferCleaner that does unmapping.
      Returns:
      null if not supported.