await() { if (flag == false) { try { wait(); } catch (InterruptedException e) {} System.out.println(Thread.currentThread().getName() + ": flag: notification received"); } else System.out.println(Thread.currentThread().getName() + ": flag: already set"); }
synchronized void await() { Thread current = Thread.currentThread(); String name = current instanceof Task ? ((Task)current).getTaskName() : "Main "; if (flag == false) { try { wait(); } catch (InterruptedException e) {} System.out.println(name + ": flag: notification received"); } else System.out.println(name + ": flag: already set"); }
   await()      {      if (flag == false)         {         try { wait(); } catch (InterruptedException e) {}         System.out.println(Thread.currentThread().getName() + ": flag: notification received");         }      else         System.out.println(Thread.currentThread().getName() + ": flag: already set");      }