avoid calling nativeIO.dropPartialFileFromCache too often
* there is no need to call fsync() every 100 milliseconds just to drop
minimal amounts of data from the file system cache.
@@ -125,9 +125,11 @@ public class LogFileHandler extends StreamHandler {
try {
if (currentOutputStream != null) {
long newPos = currentOutputStream.getChannel().position();
+ if (newPos > lastDropPosition + 102400) {
nativeIO.dropPartialFileFromCache(currentOutputStream.getFD(), lastDropPosition, newPos, true);
lastDropPosition = newPos;
}
+ }
} catch (IOException e) {
logger.warning("Failed dropping from cache : " + Exceptions.toMessageString(e));
}
