public interface RSemaphoreRx extends RExpirableRx
Semaphore.
Works in non-fair mode. Therefore order of acquiring is unpredictable.
| Modifier and Type | Method and Description |
|---|---|
io.reactivex.rxjava3.core.Completable |
acquire()
Acquires a permit.
|
io.reactivex.rxjava3.core.Completable |
acquire(int permits)
Acquires defined amount of
permits. |
io.reactivex.rxjava3.core.Completable |
addPermits(int permits)
Increases or decreases the number of available permits by defined value.
|
io.reactivex.rxjava3.core.Single<Integer> |
availablePermits()
Returns amount of available permits.
|
io.reactivex.rxjava3.core.Single<Integer> |
drainPermits()
Acquires and returns all permits that are immediately available.
|
io.reactivex.rxjava3.core.Completable |
release()
Releases a permit.
|
io.reactivex.rxjava3.core.Completable |
release(int permits)
Releases defined amount of
permits. |
io.reactivex.rxjava3.core.Single<Boolean> |
tryAcquire()
Acquires a permit.
|
io.reactivex.rxjava3.core.Single<Boolean> |
tryAcquire(int permits)
Tries to acquire defined amount of currently available
permits. |
io.reactivex.rxjava3.core.Single<Boolean> |
tryAcquire(int permits,
long waitTime,
TimeUnit unit)
Tries to acquire defined amount of currently available
permits. |
io.reactivex.rxjava3.core.Single<Boolean> |
tryAcquire(long waitTime,
TimeUnit unit)
Tries to acquire currently available permit.
|
io.reactivex.rxjava3.core.Single<Boolean> |
trySetPermits(int permits)
Tries to set number of permits.
|
clearExpire, expire, expireAt, expireAt, expireAt, remainTimeToLiveaddListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkio.reactivex.rxjava3.core.Single<Boolean> tryAcquire()
true if a permit was acquired and false
otherwiseio.reactivex.rxjava3.core.Single<Boolean> tryAcquire(int permits)
permits.permits - the number of permits to acquiretrue if permits were acquired and false
otherwiseio.reactivex.rxjava3.core.Completable acquire()
io.reactivex.rxjava3.core.Completable acquire(int permits)
permits.
Waits if necessary until all permits became available.permits - the number of permits to acquireIllegalArgumentException - if permits is negativeio.reactivex.rxjava3.core.Completable release()
io.reactivex.rxjava3.core.Completable release(int permits)
permits.permits - amountio.reactivex.rxjava3.core.Single<Boolean> trySetPermits(int permits)
permits - - number of permitstrue if permits has been set successfully, otherwise false.io.reactivex.rxjava3.core.Single<Boolean> tryAcquire(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
otherwiseio.reactivex.rxjava3.core.Single<Boolean> tryAcquire(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
otherwiseio.reactivex.rxjava3.core.Completable addPermits(int permits)
permits - amount of permits to add/removeio.reactivex.rxjava3.core.Single<Integer> availablePermits()
io.reactivex.rxjava3.core.Single<Integer> drainPermits()
Copyright © 2014–2021 Redisson. All rights reserved.