private void waitForOutstandingRequest ( ) throws IOException { if ( outstandingRequest == null ) { return ; } try { RetryHelper . runWithRetries ( new Callable < Void > ( ) { @ Override public Void call ( ) throws IOException , InterruptedException { if ( RetryHelper . getContext ( ) . getAttemptNumber ( ) > 1 ) { outstandingRequest . retry ( ) ; } token = outstandingRequest . waitForNextToken ( ) ; outstandingRequest = null ; return null ; } } , retryParams , GcsServiceImpl . exceptionHandler ) ; } catch ( RetryInterruptedException ex ) { token = null ; throw new ClosedByInterruptException ( ) ; } catch ( NonRetriableException e ) { Throwables . propagateIfInstanceOf ( e . getCause ( ) , IOException . class ) ; throw e ; } }
Waits for the current outstanding request retrying it with exponential backoff if it fails .