/guava/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java
this.nextFreeTicketMicros = LongMath.saturatedAdd( nextFreeTicketMicros, warmupPeriod) ;
this.nextFreeTicketMicros = LongMath.saturatedAdd ( nextFreeTicketMicros, waitMicros ) ;
long returnValue = nextFreeTicketMicros; double storedPermitsToSpend = min(requiredPermits, this.storedPermits); double freshPermits = requiredPermits - storedPermitsToSpend; long waitMicros = storedPermitsToWaitTime(this.storedPermits, storedPermitsToSpend) + (long) (freshPermits * stableIntervalMicros); <extra_id_0> this.storedPermits -= storedPermitsToSpend; return returnValue; } abstract long storedPermitsToWaitTime(double storedPermits, double permitsToTake); abstract double coolDownIntervalMicros(); void resync(long nowMicros) {