public void complete ( T result , Object error ) { synchronized ( this ) { if ( isComplete ) { throw new RuntimeException ( "Promise can be completed only once" ) ; } this . result = result ; this . error = error ; isComplete = true ; tryFire ( ) ; } }
to be called by code returning an result or error .