public void terminate() throws IOException {
  try {
    try {
synchronized (mJobs) {
        while (mBusy || !mJobs.isEmpty()) {
          mJobs.wait(NOT_DONE_SLEEP_TIME);
        }
      }
    }
 catch (    final InterruptedException e) {
      ProgramState.setAbort();
    }
 finally {
      shutdown();
    }
    rethrow();
  }
  finally {
    ProgramState.clearAbort();
    try {
synchronized (mQueueThread) {
        while (!mQueueDone) {
          mQueueThread.wait(NOT_DONE_SLEEP_TIME);
        }
      }
    }
 catch (    final InterruptedException e) {
    }
  }
}

public void terminate ( ) throws IOException { try { try { synchronized ( mJobs ) { while ( mBusy || ! mJobs . isEmpty ( ) ) { mJobs . wait ( NOT_DONE_SLEEP_TIME ) ; } } } catch ( final InterruptedException e ) { ProgramState . setAbort ( ) ; } finally { shutdown ( ) ; } rethrow ( ) ; } finally { ProgramState . clearAbort ( ) ; try { synchronized ( mQueueThread ) { while ( ! mQueueDone ) { mQueueThread . wait ( NOT_DONE_SLEEP_TIME ) ; } } } catch ( final InterruptedException e ) { } } }
blocks until all tasks have completed execution after a shutdown request , or the current thread is interrupted , whichever happens first .
