0

Is there a way to limit or set the blocking queue size in Google Guava RateLimiter?

Ann Mathews
  • 56
  • 1
  • 8
  • 1
    What makes you think that Guava's `RateLimiter` uses a `BlockingQueue`? – mfulton26 Apr 11 '16 at 14:49
  • Since it is blocking the requests if permit is not available, I assume it must be storing them or queueing them somewhere. – Ann Mathews Apr 12 '16 at 06:33
  • The source is open so you can take a look. Here are links to the latest versions of [`RateLimiter`](https://github.com/google/guava/blob/3eb8face47fe7783daba0469b4842ff64946fb1f/guava/src/com/google/common/util/concurrent/RateLimiter.java) and [`SmoothRateLimiter`](https://github.com/google/guava/blob/3eb8face47fe7783daba0469b4842ff64946fb1f/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java). Instead of a `BlockingQueue` you will find some calculated sleeping in `synchronized` code blocks. – mfulton26 Apr 12 '16 at 13:31

0 Answers0