2015年9月20日星期日

throttling request

就是user想要request车的arrival time。如果1s内多余5条request,就自动忽略,不然就执行

如果1s内多余5条request 就自动忽略--->这个是throttling request, 应该是类似Guava 的RateLimiter

作者: freemail165    时间: 2 小时前
public void getRequest() {
    private final static Queue<Date> q=new LinkedList<Date>();
    Date cur=new Date();. 鐣欏鐢宠璁哄潧-涓€浜╀笁鍒嗗湴
    q.offer(cur);
   if(q.size()>5) {
       Date head=q.poll();. more info on 1point3acres.com
       jf(cur-head<1) return;. From 1point 3acres bbs
   }
   // Response..
}
   


是用circular buffer ? 多谢多谢 
嗯嗯~~~~~~~~~~~