code: private static Consumer<ByteBuffer> unmapper() {
          final Lookup lookup = lookup();
          try {
              // *** sun.misc.Unsafe unmapping (Java 9+) ***
              final Class<?> unsafeClass = Class.forName("sun.misc.Unsafe");
              // first check if Unsafe has the right method, otherwise we can give up
              // without doing any security critical stuff:
              final MethodHandle unmapper = lookup.findVirtual(unsafeClass, "invokeCleaner",
                      methodType(void.class, ByteBuffer.class));
              // fetch the unsafe instance and bind it to the virtual MH:
              final Field f = unsafeClass.getDeclaredField("theUnsafe");
              f.setAccessible(true);
              final Object theUnsafe = f.get(null);
              return newBufferCleaner(ByteBuffer.class, unmapper.bindTo(theUnsafe));
          } catch (SecurityException se) {
              LOG.error(
                      "Unmapping is not supported because of missing permissions. Please grant at least the following permissions: RuntimePermission(\"accessClassInPackage.sun.misc\") "
                              + " and ReflectPermission(\"suppressAccessChecks\")",
                      se);
  
          } catch (ReflectiveOperationException | RuntimeException e) {
              LOG.error("Unmapping is not supported.", e);
          }
          return null;
      }
docs: This is adapted from org.apache.lucene.store.MMapDirectory
  
  @return