nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial GuavaRateLimiter1234567891011121314151617RateLimiter rateLimiter = RateLimiter.create(10);for (int i = 0; i < 20; i++) { int finalI = i; new Thread(new Runnable() { @Override public void run() { int cnt = 0; while (true) { if (rateLimiter.tryAcquire()) { cnt++; System.out.println("thread: " + finalI + " cnt: " + cnt); } } } }).start();}Thread.sleep(1000 * 100 * 1000); 源码流程图: