Hi guys,

I may be wrong, or tired, but while looking at the DefaultIoFuture class (trunk), I discovered that the public IoFuture awaitUninterruptibly() method is using a lock to protect a boolean flag (ready), which will never change, because the only place where this flag is modified is also protected by the same lock :

   public IoFuture awaitUninterruptibly() {
       synchronized (lock) {
           while (!ready) {
               waiters++;
               try {
                   lock.wait(DEAD_LOCK_CHECK_INTERVAL);
               } catch (InterruptedException e) {
               } finally {
                   waiters--;
                   if (!ready) {
                       checkDeadLock();
                   }
               }
           }
       }

       return this;
   }


...

   protected void setValue(Object newValue) {
       synchronized (lock) {
           // Allow only once.
           if (ready) {
               return;
           }

           result = newValue;
           ready = true;
           if (waiters > 0) {
               lock.notifyAll();
           }
       }

       notifyListeners();
   }

Do I need extra sleep ???

btw, is the name 'awaitUninterruptibly' sounds correct to any US native ?

Thanks !

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to