Proposal for adding O_DIRECT support into JDK 9

Lu, Yingqi yingqi.lu at intel.com
Thu Sep 7 22:26:07 UTC 2017


I like both of them, but second option seems to be simpler. I will use it :)

Thank you for the help! Please let me know if you see other issues.

Thanks,
Lucy

From: Brian Burkhalter [mailto:brian.burkhalter at oracle.com]
Sent: Thursday, September 07, 2017 3:24 PM
To: Lu, Yingqi <yingqi.lu at intel.com>
Cc: huaming.li at oracle.com; nio-dev at openjdk.java.net
Subject: Re: Proposal for adding O_DIRECT support into JDK 9

Another option which appears to work is to simply move the loadLibrary() call to inside main():

--- a/test/java/nio/channels/FileChannel/directio/DirectIOTest.java
+++ b/test/java/nio/channels/FileChannel/directio/DirectIOTest.java
@@ -49,10 +49,6 @@


     private static final int SIZE = 4096;


-    static {
-        System.loadLibrary("DirectIO");
-    }
-
     private static void testWrite(Path p) throws Exception {
         FileChannel fc = FileChannel.open(p, StandardOpenOption.WRITE,
                 ExtendedOpenOption.DIRECT);
@@ -113,6 +109,8 @@
             return;
         }


+        System.loadLibrary("DirectIO");
+
         try {
             testWrite(p);
             if (isFileInCache(p)) {

Thanks,

Brian

On Sep 7, 2017, at 3:20 PM, Brian Burkhalter <brian.burkhalter at oracle.com<mailto:brian.burkhalter at oracle.com>> wrote:


That would work, or perhaps you could add it to just one of the read/write tests or add a separate Util class to contain the method.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20170907/f4628308/attachment.html>


More information about the nio-dev mailing list