code: private void updateTokensStored(long now) {
      if (now <= this.nextTokenAvailableMillis) {
        return;
      }
      long millisUnaccounted = now - this.nextTokenAvailableMillis;
      double newTokens = millisUnaccounted * this.tokensPerMilli;
      this.nextTokenAvailableMillis = now;
      this.tokensStored = Math.min(this.tokensStored + newTokens, Math.max(this.tokensStored, this.maxBucketSizeInTokens));
    }
docs: Note: this method should only be called while holding the class lock. For performance, the lock is not explicitly
  acquired.