aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-09-26 14:25:33 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2018-09-26 14:25:33 +0200
commitb3dcb9755c380095a7e077db502deb6279f2cd37 (patch)
treedcc0891bd12a98ba7be576d740ae2e0d02e53d26 /vespajlib
parentb9a92932a8d8c04e1b919112ad95ecd7a49c56d9 (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.java8
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) {