package com.tazine.third.guava;

import com.google.common.util.concurrent.RateLimiter;

/**
 * Guava-限流
 */
public class RateLimiterDemo {

    public static void main(String[] args) {

        // 创建一个每秒流量为2的令牌桶
        RateLimiter limiter = RateLimiter.create(2);



    }


}

@@ -85,23 +85,86 @@
 r;%0A%0A
-/**%0A * Guava-%E9%99%90%E6%B5%81
+import java.util.Scanner;%0A%0A/**%0A * Guava-%E9%99%90%E6%B5%81%0A *%0A * @author frank%0A * @since 1.0.0
 %0A */
@@ -326,16 +326,206 @@
 );%0A%0A
-%0A%0A    %7D%0A%0A
+        Scanner sc = new Scanner(System.in);%0A%0A        while (sc.hasNext()) %7B%0A            //System.out.println(sc.next());%0A            System.out.println(%22-- %22 + limiter.tryAcquire());%0A        %7D%0A    %7D
 %0A%7D%0A

test (codeplay-third) : add the guava test.