Class Throttler

java.lang.Object
io.getunleash.util.Throttler

public class Throttler extends Object
  • Constructor Details

    • Throttler

      public Throttler(int intervalLengthSeconds, int longestAcceptableIntervalSeconds, URL target)
  • Method Details

    • decrementFailureCountAndResetSkips

      public void decrementFailureCountAndResetSkips()
      We've had one successful call, so if we had 10 failures in a row, this will reduce the skips down to 9, so that we gradually start polling more often, instead of doing max load immediately after a sequence of errors.
    • increaseSkipCount

      public void increaseSkipCount()
      We've gotten the message to back off (usually a 429 or a 50x). If we have successive failures, failure count here will be incremented higher and higher which will handle increasing our backoff, since we set the skip count to the failure count after every reset
    • maximizeSkips

      public void maximizeSkips()
      We've received an error code that we don't expect to change, which means we've already logged an ERROR. To avoid hammering the server that just told us we did something wrong and to avoid flooding the logs, we'll increase our skip count to maximum
    • performAction

      public boolean performAction()
    • skipped

      public void skipped()
    • handleHttpErrorCodes

      public void handleHttpErrorCodes(int responseCode)
    • getSkips

      public int getSkips()
    • getFailures

      public int getFailures()