Package io.airlift.concurrent
Class AsyncSemaphore<T>
java.lang.Object
io.airlift.concurrent.AsyncSemaphore<T>
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.
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncSemaphore(int maxPermits, Executor submitExecutor, Function<T, com.google.common.util.concurrent.ListenableFuture<?>> submitter) -
Method Summary
-
Constructor Details
-
AsyncSemaphore
-
-
Method Details
-
submit
-