code: public static void trySkipCache(int fd, long offset, long len)
    {
      if (!initialized || !fadvisePossible || fd < 0) {
        return;
      }
      try {
        // we ignore the return value as this is just best effort to avoid the cache
        posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED);
      }
      catch (UnsupportedOperationException uoe) {
        log.warn(uoe, "posix_fadvise is not supported");
        fadvisePossible = false;
      }
      catch (UnsatisfiedLinkError ule) {
        // if JNA is unavailable just skipping Direct I/O
        // instance of this class will act like normal RandomAccessFile
        log.warn(ule, "Unsatisfied Link error: posix_fadvise failed on file descriptor [%d], offset [%d]",
            fd, offset);
        fadvisePossible = false;
      }
      catch (Exception e) {
        // This is best effort anyway so lets just log that there was an
        // exception and forget
        log.warn(e, "Unknown exception: posix_fadvise failed on file descriptor [%d], offset [%d]",
            fd, offset);
      }
    }
docs: Remove pages from the file system page cache when they wont
  be accessed again
  
  @param fd     The file descriptor of the source file.
  @param offset The offset within the file.
  @param len    The length to be flushed.