Class RetryableThriftCall<T>


  • public class RetryableThriftCall<T>
    extends Object
    • Constructor Detail

      • RetryableThriftCall

        public RetryableThriftCall​(long start,
                                   long maxWaitTime,
                                   int maxNumRetries,
                                   RetryableThriftFunction<T> function)
        RetryableThriftCall constructor
        Parameters:
        start - initial wait time
        maxWaitTime - max wait time
        maxNumRetries - number of times to retry, 0 to retry forever
        function - function to execute
    • Method Detail

      • run

        public T run()
              throws RetryableThriftCall.RetriesExceededException
        Attempts to call the function, waiting and retrying when TException is thrown. Wait time is initially set to the start time and doubled each time, up to the maximum wait time. If maxNumRetries is 0, then this will retry forever. If maxNumRetries is non-zero, then a RuntimeException is thrown when it has exceeded he maxNumRetries parameter.
        Returns:
        T
        Throws:
        RetryableThriftCall.RetriesExceededException - when maximum number of retries has been exceeded and the cause is set to the last TException