com.amazonaws.services.simpleworkflow.flow.worker

## クラス BackoffThrottler

- java.lang.Object
- - com.amazonaws.services.simpleworkflow.flow.worker.BackoffThrottler

-     public class BackoffThrottler
      extends java.lang.Object

  Used to throttle code execution in presence of failures using exponential backoff logic. The formula used to calculate the next sleep interval is:

       min(pow(backoffCoefficient, failureCount - 1) * initialSleep, maxSleep);

  Example usage:

       BackoffThrottler throttler = new BackoffThrottler(1000, 60000, 2);
       while(!stopped) {
           try {
               throttler.throttle();
               // some code that can fail and should be throttled
               ...
               throttler.success();
           }
           catch (Exception e) {
               throttler.failure();
           }
       }

  作成者:
    fateev

- - ### コンストラクタの概要

    コンストラクタ
    コンストラクタと説明
    `BackoffThrottler(long initialSleep, long maxSleep, double backoffCoefficient)` Construct an instance of the throttler.

  - ### メソッドの概要

    メソッド
    修飾子とタイプ | メソッドと説明
    --- | ---
    `void` | `failure()` Increment failure count.
    `void` | `success()` Resent failure count to 0.
    `void` | `throttle()` Sleep if there were failures since the last success call.

    - ### クラスから継承されたメソッド java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### コンストラクタの詳細

    - #### BackoffThrottler

          public BackoffThrottler(long initialSleep,
                          long maxSleep,
                          double backoffCoefficient)

      Construct an instance of the throttler.
      パラメータ:
        `initialSleep` - time to sleep on the first failure
        `maxSleep` - maximum time to sleep independently of number of failures
        `backoffCoefficient` - coefficient used to calculate the next time to sleep.

  - ### メソッドの詳細

    - #### throttle

          public void throttle()
                        throws java.lang.InterruptedException

      Sleep if there were failures since the last success call.
      例外:
        `java.lang.InterruptedException`

    - #### success

          public void success()

      Resent failure count to 0.

    - #### failure

          public void failure()

      Increment failure count.