@ Override public synchronized void remove ( URI jobURI ) { Preconditions . checkState ( state ( ) == State . RUNNING , String . format ( "%s is not running." , this . getClass ( ) . getName ( ) ) ) ; try { long startTime = System . currentTimeMillis ( ) ; JobSpec jobSpec = getJobSpec ( jobURI ) ; Path jobSpecPath = getPathForURI ( this . jobConfDirPath , jobURI ) ; if ( fs . exists ( jobSpecPath ) ) { fs . delete ( jobSpecPath , false ) ; this . mutableMetrics . updateRemoveJobTime ( startTime ) ; this . listeners . onDeleteJob ( jobURI , jobSpec . getVersion ( ) ) ; } else { LOGGER . warn ( "No file with URI:" + jobSpecPath + " is found. Deletion failed." ) ; } } catch ( IOException e ) { throw new RuntimeException ( "When removing a JobConf. file, issues unexpected happen:" + e . getMessage ( ) ) ; } catch ( SpecNotFoundException e ) { LOGGER . warn ( "No file with URI:" + jobURI + " is found. Deletion failed." ) ; } }
Allow user to programmatically delete a new JobSpec . This method is designed to be reentrant .