summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java8
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/NativeIO.java8
2 files changed, 8 insertions, 8 deletions
diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java
index 95f056288d5..9963429bf97 100644
--- a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java
+++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java
@@ -276,16 +276,16 @@ public class LogFileHandler extends StreamHandler {
private void triggerCompression(String oldFileName) {
try {
- String zippedFileName = oldFileName + ".gz";
+ String gzippedFileName = oldFileName + ".gz";
Runtime r = Runtime.getRuntime();
StringBuilder cmd = new StringBuilder("gzip");
- cmd.append(" < "). append(oldFileName).append(" > ").append(zippedFileName);
+ cmd.append(" < "). append(oldFileName).append(" > ").append(gzippedFileName);
Process p = r.exec(cmd.toString());
NativeIO nativeIO = new NativeIO();
File oldFile = new File(oldFileName);
- nativeIO.dropFileFromCache(oldFile);
+ nativeIO.dropFileFromCache(oldFile); // Drop from cache in case somebody else has a reference to it preventing from dying quickly.
oldFile.delete();
- nativeIO.dropFileFromCache(new File(zippedFileName));
+ nativeIO.dropFileFromCache(new File(gzippedFileName));
// Detonator pattern: Think of all the fun we can have if gzip isn't what we
// think it is, if it doesn't return, etc, etc
} catch (IOException e) {
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) {