public void awaitNextRetry ( ) throws InterruptedException , NoMoreRetriesException { this . retryNumber ++ ; if ( this . retryNumber > this . maxRetries ) { throw new NoMoreRetriesException ( "Reached maximum number of retries: " + this . maxRetries ) ; } else if ( this . totalWait > this . maxWait ) { throw new NoMoreRetriesException ( "Reached maximum time to wait: " + this . maxWait ) ; } Thread . sleep ( this . nextDelay ) ; this . totalWait += this . nextDelay ; this . nextDelay = Math . min ( ( long ) ( this . alpha * this . nextDelay ) + 1 , this . maxDelay ) ; }
Block until next retry can be executed .