public void run(){
  Thread currentThread=Thread.currentThread();
  boolean interrupted=false;
synchronized (mainLock) {
    try {
      mainLock.notifyAll();
      while (blockerThread == currentThread) {
        mainLock.wait();
        timeoutPassed=false;
        while (isReadyToShutdown()) {
          if (timeoutPassed) {
            timeoutPassed=false;
            blockerThread=null;
            break;
          }
          timeoutPassed=true;
          mainLock.wait(SAFETY_TIMEOUT);
        }
      }
    }
 catch (    InterruptedException e) {
      interrupted=true;
    }
 finally {
      if (blockerThread == currentThread) {
        blockerThread=null;
      }
    }
  }
  if (!interrupted) {
    AppContext.stopEventDispatchThreads();
  }
}

public void run ( ) { Thread currentThread = Thread . currentThread ( ) ; boolean interrupted = false ; synchronized ( mainLock ) { try { mainLock . notifyAll ( ) ; while ( blockerThread == currentThread ) { mainLock . wait ( ) ; timeoutPassed = false ; while ( isReadyToShutdown ( ) ) { if ( timeoutPassed ) { timeoutPassed = false ; blockerThread = null ; break ; } timeoutPassed = true ; mainLock . wait ( SAFETY_TIMEOUT ) ; } } } catch ( InterruptedException e ) { interrupted = true ; } finally { if ( blockerThread == currentThread ) { blockerThread = null ; } } } if ( ! interrupted ) { AppContext . stopEventDispatchThreads ( ) ; } }
implementation of the runnable interface . incapsulates the blocker thread functionality .
