public interface RSemaphoreAsync extends RExpirableAsync
Semaphore.
Works in non-fair mode. Therefore order of acquiring is unpredictable.
| Modifier and Type | Method and Description |
|---|---|
RFuture<Void> |
acquireAsync()
Acquires a permit.
|
RFuture<Void> |
acquireAsync(int permits)
Acquires defined amount of
permits. |
RFuture<Void> |
addPermitsAsync(int permits)
Increases or decreases the number of available permits by defined value.
|
RFuture<Integer> |
availablePermitsAsync()
Returns amount of available permits.
|
RFuture<Integer> |
drainPermitsAsync()
Acquires and returns all permits that are immediately available.
|
RFuture<Void> |
releaseAsync()
Releases a permit.
|
RFuture<Void> |
releaseAsync(int permits)
Releases defined amount of
permits. |
RFuture<Boolean> |
tryAcquireAsync()
Acquires a permit.
|
RFuture<Boolean> |
tryAcquireAsync(int permits)
Tries to acquire defined amount of currently available
permits. |
RFuture<Boolean> |
tryAcquireAsync(int permits,
long waitTime,
TimeUnit unit)
Tries to acquire defined amount of currently available
permits. |
RFuture<Boolean> |
tryAcquireAsync(long waitTime,
TimeUnit unit)
Tries to acquire currently available permit.
|
RFuture<Boolean> |
trySetPermitsAsync(int permits)
Tries to set number of permits.
|
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsyncaddListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsyncRFuture<Boolean> tryAcquireAsync()
true if a permit was acquired and false
otherwiseRFuture<Boolean> tryAcquireAsync(int permits)
permits.permits - the number of permits to acquiretrue if permits were acquired and false
otherwiseRFuture<Void> acquireAsync()
RFuture<Void> acquireAsync(int permits)
permits.
Waits if necessary until all permits became available.permits - the number of permits to acquireIllegalArgumentException - if permits is negativeRFuture<Void> releaseAsync(int permits)
permits.permits - amountRFuture<Boolean> trySetPermitsAsync(int permits)
permits - - number of permitstrue if permits has been set successfully, otherwise false.RFuture<Boolean> tryAcquireAsync(long waitTime, TimeUnit unit)
waitTime if necessary until a permit became available.waitTime - the maximum time to waitunit - the time unittrue if a permit was acquired and false
otherwiseRFuture<Boolean> tryAcquireAsync(int permits, long waitTime, TimeUnit unit)
permits.
Waits up to defined waitTime if necessary until all permits became available.permits - amount of permitswaitTime - the maximum time to waitunit - the time unittrue if permits were acquired and false
otherwiseRFuture<Void> addPermitsAsync(int permits)
permits - amount of permits to add/removeRFuture<Integer> availablePermitsAsync()
Copyright © 2014–2021 Redisson. All rights reserved.