I.e., if an expensive task arrives at an idle RateLimiter, it will be granted immediately, but it is the next request that will experience extra throttling, thus paying for the cost of the expensive task.' but it affects the throttling of the next request. I could imaginge there is some throttling adding up or other effect in the RateLimiter, i would try to play around with it and make sure this thing really works the way you want.Īlternatively, consider using Spring to read from your queue.
You might want to spice it up using embedded JMS for further goodies (message persistence etc).