nurkiewicz/token-bucket — pull request #1 by rworsnop (2013-10-31 14:49:21+00:00)
Title: Fixed bug, moved to Guava RateLimiter etc

See individual commits for more detail, but briefly:
- Fixed bug that occured when file size was exact multiple of buffer size
- Switched to Guava RateLimiter
- Replaced per-request throttling with global throttling. I left a comment on the blog about this. I don't think you need per-request throttling with the Servlet 3.0 async stuff.
- Solved "spinning problem", where chunks were repeatedly placed to the back of the queue due to throttling. Since we throttle at a global level, it is now fine to block the download thread until we RateLimiter allows us to proceed again.