Proposal for adding O_DIRECT support into JDK 9

Brian Burkhalter brian.burkhalter at oracle.com
Thu Sep 7 22:23:52 UTC 2017


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> 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/36835d8a/attachment.html>


More information about the nio-dev mailing list