diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-26 17:14:10 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-26 17:14:10 +0200 |
commit | 1fc51f44fc8e4bed1074a8497a8531143fe53b09 (patch) | |
tree | 850911c48825341d4a190cc4ca87f162f59aa616 /vespajlib/src | |
parent | 3b4914bf41531ac7954cd8be3e0286dd0a927609 (diff) |
Make legger static and add some interface comments
Diffstat (limited to 'vespajlib/src')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/io/NativeIO.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java index bee43a8653e..99c70b405b1 100644 --- a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java +++ b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java @@ -12,8 +12,11 @@ import com.sun.jna.LastErrorException; import com.sun.jna.Native; import com.sun.jna.Platform; +/** + * Provides functionality only possible through native C library. + */ public class NativeIO { - private final Logger logger = Logger.getLogger(getClass().getName()); + private final static Logger logger = Logger.getLogger(NativeIO.class.getName()); private static final int POSIX_FADV_DONTNEED = 4; // See /usr/include/linux/fadvise.h private static boolean initialized = false; private static Throwable initError = null; @@ -48,12 +51,20 @@ public class NativeIO { } } + /** + * Will hint the OS that this is will not be accessed again and should hence be dropped from the buffer cache. + * @param fd The file descriptor to drop from buffer cache. + */ public void dropFileFromCache(FileDescriptor fd) { if (initialized) { posix_fadvise(getNativeFD(fd), 0, 0, POSIX_FADV_DONTNEED); } } + /** + * Will hint the OS that this is will not be accessed again and should hence be dropped from the buffer cache. + * @param file File to drop from buffer cache + */ public void dropFileFromCache(File file) { try { dropFileFromCache(new FileInputStream(file).getFD()); |