final long reserveAndGetWaitLength ( int permits , long nowMicros ) { long momentAvailable = reserveEarliestAvailable ( permits , nowMicros ) ; return max ( momentAvailable - nowMicros , 0 ) ; }
Reserves next ticket and returns the wait time that the caller must wait for .