cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snazy <...@git.apache.org>
Subject [GitHub] cassandra pull request #236: 9608 trunk
Date Mon, 02 Jul 2018 09:45:41 GMT
Github user snazy commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/236#discussion_r199440755
  
    --- Diff: src/java/org/apache/cassandra/io/util/FileUtils.java ---
    @@ -67,23 +71,84 @@
         public static final boolean isCleanerAvailable;
         private static final AtomicReference<Optional<FSErrorHandler>> fsErrorHandler
= new AtomicReference<>(Optional.empty());
     
    +    private static Class clsDirectBuffer;
    +    private static MethodHandle mhDirectBufferCleaner;
    +    private static MethodHandle mhCleanerClean;
    +    private static MethodHandle mhDirectBufferAddress;
    +
         static
         {
             boolean canClean = false;
             try
             {
    +            clsDirectBuffer = Class.forName("sun.nio.ch.DirectBuffer");
    +            Method mDirectBufferCleaner = clsDirectBuffer.getMethod("cleaner");
    +            mhDirectBufferCleaner = MethodHandles.lookup().unreflect(mDirectBufferCleaner);
    +            Method mCleanerClean = mDirectBufferCleaner.getReturnType().getMethod("clean");
    +            mhCleanerClean = MethodHandles.lookup().unreflect(mCleanerClean);
    +            Method mDirectBufferAddress = clsDirectBuffer.getMethod("address");
    +            mhDirectBufferAddress = MethodHandles.lookup().unreflect(mDirectBufferAddress);
    +
                 ByteBuffer buf = ByteBuffer.allocateDirect(1);
    -            ((DirectBuffer) buf).cleaner().clean();
    +            cleanerClean(buf);
                 canClean = true;
             }
             catch (Throwable t)
             {
    +            logger.info("Cannot initialize un-mmaper. Compacted data files will not be
removed promptly.", t);
    --- End diff --
    
    Sounds good


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message