diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-26 14:25:33 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-26 14:25:33 +0200 |
commit | b3dcb9755c380095a7e077db502deb6279f2cd37 (patch) | |
tree | dcc0891bd12a98ba7be576d740ae2e0d02e53d26 /vespajlib | |
parent | b9a92932a8d8c04e1b919112ad95ecd7a49c56d9 (diff) |
Fix comments from pull request review.
- Better naming and make static what can be static.
Diffstat (limited to 'vespajlib')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/io/NativeIO.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java index 18779022d99..bee43a8653e 100644 --- a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java +++ b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java @@ -28,7 +28,8 @@ public class NativeIO { } } - private final Field fieldFD; + private static final Field fieldFD = getField(FileDescriptor.class, "fd"); + private static native int posix_fadvise(int fd, long offset, long len, int flag) throws LastErrorException; @@ -36,7 +37,6 @@ public class NativeIO { if (!initialized) { logger.warning("native IO not possible due to " + getError().getMessage()); } - fieldFD = getField(FileDescriptor.class, "fd"); } public boolean valid() { return initialized; } @@ -50,7 +50,7 @@ public class NativeIO { public void dropFileFromCache(FileDescriptor fd) { if (initialized) { - posix_fadvise(getfh(fd), 0, 0, POSIX_FADV_DONTNEED); + posix_fadvise(getNativeFD(fd), 0, 0, POSIX_FADV_DONTNEED); } } @@ -76,7 +76,7 @@ public class NativeIO { return field; } - private int getfh(FileDescriptor fd) { + private static int getNativeFD(FileDescriptor fd) { try { return fieldFD.getInt(fd); } catch (IllegalAccessException e) { |