| 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-----");  | 
|     }  | 
|   | 
|   | 
| }  |