protected void waitForPromiseSuccess ( ) throws IOException , TimeoutException { while ( ! promise . isDone ( ) && ! promise . isCancelled ( ) ) { Promise < T > listeningPromise = this . promise ; listeningPromise . awaitUninterruptibly ( ) ; if ( listeningPromise == this . promise ) { this . handlePromise ( promise ) ; break ; } } }
Wait for promise to be done