Class ExponentialPollAlgorithm

    • Constructor Detail

      • ExponentialPollAlgorithm

        public ExponentialPollAlgorithm​(RetrySettings globalSettings,
                                        com.google.api.core.ApiClock clock)
        Creates a new exponential poll algorithm instance.
        Parameters:
        globalSettings - global poll settings (attempt independent)
        clock - clock to use for time-specific calculations
        Throws:
        NullPointerException - if either globalSettings or clock is null
    • Method Detail

      • shouldRetry

        public boolean shouldRetry​(TimedAttemptSettings nextAttemptSettings)
                            throws PollException
        Returns true if another poll operation should be made or throws PollException, if either total timeout or total number of attempts is exceeded.
        Specified by:
        shouldRetry in interface TimedRetryAlgorithm
        Overrides:
        shouldRetry in class ExponentialRetryAlgorithm
        Parameters:
        nextAttemptSettings - attempt settings, which will be used for the next attempt, if accepted
        Returns:
        true if more attempts should be made, never returns false (throws PollException instead)
        Throws:
        PollException - if no more attempts should be made