Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: changed bool to boolean

...

Code Block
bgColor#ccccff
final class ControlledStop implements Runnable {
  private boolean done = false;
 
  public void run() {
    while (!isDone()) {
      try {
        // ...
        Thread.currentThread().sleep(1000); // Do something
      } catch(InterruptedException ie) { 
        // handle exception
      } 
    } 	 
  }

  protected synchronized boolboolean isDone() {
    return done;
  }

  protected synchronized void shutdown() {
    done = true;
  }
}

...