synchronized void refill() {
        double timestamp = clock.time();
        if (lastTimestamp == null) {
            lastTimestamp = timestamp;
            return;
        }

        double fillAmount = (timestamp - lastTimestamp) * fillRate;
        currentCapacity = Math.min(maxCapacity, currentCapacity + fillAmount);
        lastTimestamp = timestamp;
    }
<pre>
_TokenBucketRefill()
  timestamp = time()
  if last_timestamp is unset
    last_timestamp = timestamp
    return
  fill_amount = (timestamp - last_timestamp) * fill_rate
  current_capacity = min(max_capacity, current_capacity + fill_amount)
  last_timestamp = timestamp
</pre>
aws-java-sdk-core/src/main/java/com/amazonaws/internal/TokenBucket.java