@Experimental public class SinkUtils extends Object implements Serializable
Constructor and Description |
---|
SinkUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
tryAcquire(int permits,
int maxConcurrentRequests,
Duration maxConcurrentRequestsTimeout,
Semaphore semaphore)
Acquire permits on the given semaphore within a given allowed timeout and deal with errors.
|
public static void tryAcquire(int permits, int maxConcurrentRequests, Duration maxConcurrentRequestsTimeout, Semaphore semaphore) throws InterruptedException, TimeoutException
permits
- the mumber of permits to acquire.maxConcurrentRequests
- the maximum number of permits the semaphore was initialized
with.maxConcurrentRequestsTimeout
- the timeout to acquire the permits.semaphore
- the semaphore to acquire permits to.InterruptedException
- if the current thread was interrupted.TimeoutException
- if the waiting time elapsed before all permits were acquired.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.