public void setValue ( Object newValue ) { synchronized ( lock ) { // Allow only once. if ( ready ) { return ; } result = newValue ; ready = true ; if ( waiters > 0 ) { lock . notifyAll ( ) ; } } notifyListeners ( ) ; }
Sets the result of the asynchronous operation and mark it as finished .