public void cancel(){
synchronized (this) {
    if (performingPrinting) {
      userCancelled=true;
    }
    notify();
  }
}

public void cancel ( ) { synchronized ( this ) { if ( performingPrinting ) { userCancelled = true ; } notify ( ) ; } }
if a print job is in progress , print ( ) has been called but has not returned , then this signals that the job should be cancelled and the next chance . if there is no print job in progress then this call does nothing .
