Class ReconnectContext

java.lang.Object
discord4j.common.retry.ReconnectContext

public class ReconnectContext extends Object
Encapsulate retrying state for reconnect operations.

Used as context for Retry calls, keeps track of the current retry attempt for backoff calculations (through next() and restarting the attempt count once a retry has succeeded (through reset()).

  • Constructor Details

    • ReconnectContext

      public ReconnectContext(Duration firstBackoff, Duration maxBackoffInterval)
  • Method Details

    • next

      public void next()
      Signal that the next retry attempt should be underway.
    • reset

      public void reset()
      Reset the attempt count, treating further calls to next() as new retry sequences.
    • clear

      public void clear()
      Clear the attempt count, treating further calls to next() as brand new retry context.
    • getFirstBackoff

      public Duration getFirstBackoff()
    • getMaxBackoffInterval

      public Duration getMaxBackoffInterval()
    • getAttempts

      public int getAttempts()
    • getResetCount

      public int getResetCount()