private boolean checkPolicy ( int executionCount ) { if ( mechanism . equalsIgnoreCase ( "fixedretry" ) ) { if ( this . retryCount == 0 ) { return false ; } else if ( executionCount < this . retryCount ) { try { Thread . sleep ( ( long ) this . retryInterval ) ; LOG . debug ( "The retryInterval " + this . retryInterval ) ; return true ; } catch ( Exception e ) { LOG . error ( e . getMessage ( ) ) ; } } return false ; } // functionality for incremental retry policy if ( mechanism . equalsIgnoreCase ( "incrementalretry" ) ) { if ( executionCount < this . retryCount ) { try { Thread . sleep ( ( long ) this . initialInterval + ( this . increment * executionCount ) ) ; return true ; } catch ( Exception e ) { LOG . error ( e . getMessage ( ) ) ; } } return false ; } // functionality for exponential retry if ( mechanism . equalsIgnoreCase ( "exponentialretry" ) ) { if ( executionCount < this . retryCount ) { try { int delta = ( int ) ( ( Math . pow ( 2.0 , executionCount ) - 1.0 ) * ( this . deltaBackoff * NUM_0_8 ) + ( Math . random ( ) * ( this . deltaBackoff * NUM_1_2 ) - ( this . deltaBackoff * NUM_0_8 ) + 1 ) ) ; int interval = ( int ) Math . min ( ( this . minBackoff + delta ) , this . maxBackoff ) ; Thread . sleep ( interval ) ; } catch ( Exception e ) { LOG . error ( e . getMessage ( ) ) ; } return true ; } return false ; } return true ; }
Method to check the retry request policy