Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FixedWindowRecord extends AbstractTokenRecord {
- private Instant windowEnd;
- ...
- @Override
- public RateLimitRecord updateWith(RefillPolicy policy, Instant requestTs) {
- if (requestTs.isAfter(windowEnd)) {
- return new FixedWindowRecord(policy.getCapacity(), windowEnd.plus(policy.getSamplingPeriod()));
- }
- return this;
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement