public static boolean renameAggressively(File oldFile, File newFile) {
    boolean renameOK = oldFile.renameTo(newFile.getAbsoluteFile());
    if (!renameOK) {
      try {
        LogFileUtils.copyFile(oldFile, newFile.getAbsoluteFile());
        long timeStop = System.currentTimeMillis() + 600000;
        boolean noDelete = !oldFile.delete();
        if (noDelete) {
          try {
            RandomAccessFile raf = new RandomAccessFile(oldFile, "rws");
            raf.setLength(0);
            raf.close();
            noDelete = false;
          } catch (Exception e) {
            // ignore this
          }
        }

        if (noDelete) {
          LogFileUtils.delete(newFile.getAbsoluteFile());
          renameOK = false;
        } else {
          renameOK = true;
        }
      } catch (IOException e) {
        // ignore this and just return failure
      }
    }
    return renameOK;
  }
Delete a file ignoring exceptions.

@param file to delete, can be <code>null</code>
geode-core/src/main/java/org/apache/geode/internal/util/LogFileUtils.java