public synchronized void updateClientSendingRate(boolean throttlingResponse) {
        updateMeasuredRate();

        double calculatedRate;
        if (throttlingResponse) {
            double rateToUse;
            if (!enabled) {
                rateToUse = measuredTxRate;
            } else {
                rateToUse = Math.min(measuredTxRate, fillRate);
            }

            lastMaxRate = rateToUse;
            calculateTimeWindow();
            lastThrottleTime = clock.time();
            calculatedRate = cubicThrottle(rateToUse);
            enable();
        } else {
            calculateTimeWindow();
            calculatedRate = cubicSuccess(clock.time());
        }

        double newRate = Math.min(calculatedRate, 2 * measuredTxRate);
        updateRate(newRate);
    }
<pre>
_UpdateClientSendingRate(response)
  _UpdateMeasuredRate()

  if IsThrottlingError(response)
    if not enabled
      rate_to_use = measured_tx_rate
    else
      rate_to_use = min(measured_tx_rate, fill_rate)

    # The fill_rate is from the token bucket.
    last_max_rate = rate_to_use
    _CalculateTimeWindow()
    last_throttle_time = time()
    calculated_rate = _CUBICThrottle(rate_to_use)
    TokenBucketEnable()
  else
    _CalculateTimeWindow()
    calculated_rate = _CUBICSuccess(time())

  new_rate = min(calculated_rate, 2 * measured_tx_rate)
  _TokenBucketUpdateRate(new_rate)
</pre>
aws-java-sdk-core/src/main/java/com/amazonaws/internal/TokenBucket.java