xiaoyong931011
2021-07-14 cf148cae4937f807347e56d94b2dc96c9f258c59
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.xzx.gc.util.limitnetflow;
 
import com.google.common.util.concurrent.RateLimiter;
 
/**
 * 令牌生成
 * 基于内存的限流算法
 */
public class TokenFactory {
 
    public static void init(){
        RateLimiter rateLimiter = RateLimiter.create(10);
        rateLimiter.acquire();
    }
 
    public static void main(String[] args) throws Exception{
 
 
        System.out.println("-----out-----");
    }
 
 
}