private static boolean nextSleep ( BackOff backoff , Sleeper sleeper , Exception currentException ) throws InterruptedException { long backOffTime ; try { backOffTime = backoff . nextBackOffMillis ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "Failed to to get next back off time" , e ) ; } if ( backOffTime == BackOff . STOP ) { return false ; } logger . atInfo ( ) . withCause ( currentException ) . log ( "Transient exception caught. Sleeping for %d, then retrying." , backOffTime ) ; sleeper . sleep ( backOffTime ) ; return true ; }
Determines the amount to sleep for and sleeps if needed .