Class PollingOptions


  • public class PollingOptions
    extends java.lang.Object
    Configuration options for polling operations with hybrid polling strategy.

    The default strategy polls at 1-second intervals for the first 30 seconds, then gradually increases the interval using exponential backoff (1.15x multiplier) up to a maximum of 30 seconds between polls.

    Use the builder pattern to create instances with custom values:

    
     // Polls indefinitely with default hybrid strategy
     PollingOptions options = PollingOptions.builder().build();
    
     // With custom timeout
     PollingOptions options = PollingOptions.builder()
         .maxWaitMs(300000)  // 5 minutes
         .build();
    
     // Custom fast polling phase
     PollingOptions options = PollingOptions.builder()
         .fastPollDurationMs(60000)  // Fast poll for 60 seconds
         .fastPollIntervalMs(500)    // Poll every 500ms during fast phase
         .build();
     
    • Field Detail

      • DEFAULT_FAST_POLL_DURATION_MS

        public static final int DEFAULT_FAST_POLL_DURATION_MS
        Default fast poll duration: 30 seconds (30,000 ms).
        See Also:
        Constant Field Values
      • DEFAULT_FAST_POLL_INTERVAL_MS

        public static final int DEFAULT_FAST_POLL_INTERVAL_MS
        Default fast poll interval: 1 second (1,000 ms).
        See Also:
        Constant Field Values
      • DEFAULT_INITIAL_DELAY_MS

        public static final int DEFAULT_INITIAL_DELAY_MS
        Default initial delay for backoff phase: 1 second (1,000 ms).
        See Also:
        Constant Field Values
      • DEFAULT_MAX_DELAY_MS

        public static final int DEFAULT_MAX_DELAY_MS
        Default maximum delay between polls: 30 seconds (30,000 ms).
        See Also:
        Constant Field Values
      • DEFAULT_BACKOFF_MULTIPLIER

        public static final double DEFAULT_BACKOFF_MULTIPLIER
        Default backoff multiplier: 1.15 (15% increase each attempt).
        See Also:
        Constant Field Values
      • DEFAULT_JITTER_FRACTION

        public static final double DEFAULT_JITTER_FRACTION
        Default jitter fraction: 0.25 (±25% randomization).
        See Also:
        Constant Field Values
    • Method Detail

      • getMaxWaitMs

        public java.lang.Integer getMaxWaitMs()
        Returns the maximum total wait time in milliseconds, or null if polling indefinitely.
      • hasTimeout

        public boolean hasTimeout()
        Returns whether a timeout is configured.
      • getFastPollDurationMs

        public int getFastPollDurationMs()
        Returns the duration of the fast polling phase in milliseconds.
      • getFastPollIntervalMs

        public int getFastPollIntervalMs()
        Returns the interval between polls during the fast polling phase in milliseconds.
      • getInitialDelayMs

        public int getInitialDelayMs()
        Returns the initial delay for the backoff phase in milliseconds.
      • getMaxDelayMs

        public int getMaxDelayMs()
        Returns the maximum delay between polls in milliseconds.
      • getBackoffMultiplier

        public double getBackoffMultiplier()
        Returns the multiplier for exponential backoff.
      • getJitterFraction

        public double getJitterFraction()
        Returns the jitter fraction for delay randomization.
      • getRequestOptions

        public RequestOptions getRequestOptions()
        Returns the request options to pass to API calls.
      • defaults

        public static PollingOptions defaults()
        Creates default polling options (polls indefinitely).