Class AsyncSemaphore<T,R>

java.lang.Object
io.airlift.concurrent.AsyncSemaphore<T,R>

@ThreadSafe public class AsyncSemaphore<T,R> extends Object
Guarantees that no more than maxPermits of tasks will be run concurrently. The class will rely on the ListenableFuture returned by the submitter function to determine when a task has been completed. The submitter function NEEDS to be thread-safe and is recommended to do the bulk of its work asynchronously.