如果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 ? 多谢多谢
嗯嗯~~~~~~~~~~~