private void cleanupSwapDirectory ( ) { PrivilegedAction < Void > action = new PrivilegedAction < Void > ( ) { public Void run ( ) { File [ ] files = containerConfig . spoolConfig . tempDirectory . listFiles ( ) ; if ( files != null && files . length > 0 ) { LOG . info ( "Some files have been found in the swap directory and will be deleted" ) ; for ( int i = 0 ; i < files . length ; i ++ ) { File file = files [ i ] ; // We don't use the file cleaner in case the deletion failed to ensure // that the file won't be deleted while it is currently re-used file . delete ( ) ; } } return null ; } } ; SecurityHelper . doPrivilegedAction ( action ) ; }
Deletes all the files from the swap directory