public synchronized boolean delete ( final Job job ) { // if already shutdown in the process of shutdown, there is no // need to remove Jobs as they will never be executed. if ( shutdown ) { return false ; } int i = findIndex ( job ) ; if ( i != - 1 ) { ScheduledJobEntry se = ( ScheduledJobEntry ) jobList . remove ( i ) ; if ( se . job != job ) { // this should never happen new IllegalStateException ( "Internal programming error" ) ; } // if the job is the first on the list, // then notify the scheduler thread to schedule a new job if ( i == 0 ) { this . notifyAll ( ) ; } return true ; } else { return false ; } }
Delete the given job .