public static boolean deleteFile(final File file,final Logger logger,final int attempts){
  if (file == null) {
    return false;
  }
  boolean isGone=false;
  try {
    if (file.exists()) {
      final int effectiveAttempts=Math.max(1,attempts);
      for (int i=0; i < effectiveAttempts && !isGone; i++) {
        isGone=file.delete() || !file.exists();
        if (!isGone && (effectiveAttempts - i) > 1) {
          FileUtils.sleepQuietly(MILLIS_BETWEEN_ATTEMPTS);
        }
      }
      if (!isGone && logger != null) {
        logger.warn("File appears to exist but unable to delete file: " + file.getAbsolutePath());
      }
    }
  }
 catch (  final Throwable t) {
    if (logger != null) {
      logger.warn("Unable to delete file: '" + file.getAbsolutePath() + "' due to "+ t);
    }
  }
  return isGone;
}

public static boolean deleteFile ( final File file , final Logger logger , final int attempts ) { if ( file == null ) { return false ; } boolean isGone = false ; try { if ( file . exists ( ) ) { final int effectiveAttempts = Math . max ( 1 , attempts ) ; for ( int i = 0 ; i < effectiveAttempts && ! isGone ; i ++ ) { isGone = file . delete ( ) || ! file . exists ( ) ; if ( ! isGone && ( effectiveAttempts - i ) > 1 ) { FileUtils . sleepQuietly ( MILLIS_BETWEEN_ATTEMPTS ) ; } } if ( ! isGone && logger != null ) { logger . warn ( "File appears to exist but unable to delete file: " + file . getAbsolutePath ( ) ) ; } } } catch ( final Throwable t ) { if ( logger != null ) { logger . warn ( "Unable to delete file: '" + file . getAbsolutePath ( ) + "' due to " + t ) ; } } return isGone ; }
deletes the given file . if the given file exists but could not be deleted this will be printed as a warning to the given logger
