5

Guava的rateLimiter的tryAcquire为什么每次都多消费一个?

 3 years ago
source link: https://www.oschina.net/question/2491333_2323368
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Guava的rateLimiter的tryAcquire为什么每次都多消费一个?

sfasdfasdfasf 发布于 昨天 13:16

Guava的ratelimiter的tryAcquire为什么每次都多消费一个?

每秒产生一个令牌,延迟一秒,十个并发,按道理只会消费两个(第一次请求的一个,一秒后再消费一个),但实际消费了三个。

每秒产生两个令牌,延迟一秒,十个并发,按道理只会消费四个(第一次请求的两个,一秒后再消费两个),但实际消费了五个。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK