diff options
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/io/NativeIO.java')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/io/NativeIO.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java index 5adb509ac3b..18779022d99 100644 --- a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java +++ b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java @@ -34,16 +34,20 @@ public class NativeIO { public NativeIO() { if (!initialized) { - logger.warning("native IO not possible due to " + initError); - if (initError != null) { - throw new RuntimeException(initError); - } else { - throw new RuntimeException("Platform is unsúpported. Only supported on linux."); - } + logger.warning("native IO not possible due to " + getError().getMessage()); } fieldFD = getField(FileDescriptor.class, "fd"); } + public boolean valid() { return initialized; } + public Throwable getError() { + if (initError != null) { + return initError; + } else { + return new RuntimeException("Platform is unsúpported. Only supported on linux."); + } + } + public void dropFileFromCache(FileDescriptor fd) { if (initialized) { posix_fadvise(getfh(fd), 0, 0, POSIX_FADV_DONTNEED); |