public BoxAPIResponse send ( ProgressListener listener ) { if ( this . api == null ) { this . backoffCounter . reset ( BoxGlobalSettings . getMaxRequestAttempts ( ) ) ; } else { this . backoffCounter . reset ( this . api . getMaxRequestAttempts ( ) ) ; } while ( this . backoffCounter . getAttemptsRemaining ( ) > 0 ) { try { return this . trySend ( listener ) ; } catch ( BoxAPIException apiException ) { if ( ! this . backoffCounter . decrement ( ) || ! isResponseRetryable ( apiException . getResponseCode ( ) ) ) { throw apiException ; } try { this . resetBody ( ) ; } catch ( IOException ioException ) { throw apiException ; } try { this . backoffCounter . waitBackoff ( ) ; } catch ( InterruptedException interruptedException ) { Thread . currentThread ( ) . interrupt ( ) ; throw apiException ; } } } throw new RuntimeException ( ) ; }
Sends this request while monitoring its progress and returns a BoxAPIResponse containing the server s response .