Ejemplo n.º 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;
   }
 }
Ejemplo n.º 2
0
 public synchronized void failed() {
   done = to.compareTo(from()) > 0 ? from() : to;
   notifyAll();
 }