Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. public class FixedWindowRecord extends AbstractTokenRecord {
  2.    
  3.     private Instant windowEnd;
  4.    
  5.     ...
  6.  
  7.     @Override
  8.     public RateLimitRecord updateWith(RefillPolicy policy, Instant requestTs) {
  9.         if (requestTs.isAfter(windowEnd)) {
  10.             return new FixedWindowRecord(policy.getCapacity(), windowEnd.plus(policy.getSamplingPeriod()));
  11.         }
  12.         return this;
  13.     }
  14.  
  15.     ...
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement