예제 #1
0
 public InternalStatus get() {
   if (done != null) {
     return done;
   } else if (owner == Thread.currentThread()) {
     return to.compareTo(from()) > 0 ? to : from();
   }
   synchronized (this) {
     boolean interrupted = false;
     try {
       while (done == null) {
         try {
           wait();
         } catch (InterruptedException e) {
           interrupted = true;
         }
       }
     } finally {
       if (interrupted) {
         Thread.currentThread().interrupt();
       }
     }
     return done;
   }
 }
예제 #2
0
 public synchronized void failed() {
   done = to.compareTo(from()) > 0 ? from() : to;
   notifyAll();
 }