public interface RPermitExpirableSemaphoreReactive extends RExpirableReactive
Each permit identified by own id and could be released only using its id. Permit id is a 128-bits unique random identifier generated each time during acquiring.
Works in non-fair mode. Therefore order of acquiring is unpredictable.
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<String> |
acquire()
Acquires a permit and returns its id.
|
reactor.core.publisher.Mono<String> |
acquire(long leaseTime,
TimeUnit unit)
Acquires a permit with defined
leaseTime and return its id. |
reactor.core.publisher.Mono<Void> |
addPermits(int permits)
Increases or decreases the number of available permits by defined value.
|
reactor.core.publisher.Mono<Integer> |
availablePermits()
Returns amount of available permits.
|
reactor.core.publisher.Mono<Void> |
release(String permitId)
Releases a permit by its id.
|
reactor.core.publisher.Mono<String> |
tryAcquire()
Tries to acquire currently available permit and return its id.
|
reactor.core.publisher.Mono<String> |
tryAcquire(long waitTime,
long leaseTime,
TimeUnit unit)
Tries to acquire currently available permit
with defined
leaseTime and return its id. |
reactor.core.publisher.Mono<String> |
tryAcquire(long waitTime,
TimeUnit unit)
Tries to acquire currently available permit and return its id.
|
reactor.core.publisher.Mono<Boolean> |
tryRelease(String permitId)
Tries to release permit by its id.
|
reactor.core.publisher.Mono<Boolean> |
trySetPermits(int permits)
Tries to set number of permits.
|
reactor.core.publisher.Mono<Boolean> |
updateLeaseTime(String permitId,
long leaseTime,
TimeUnit unit)
Overrides and updates lease time for defined permit id.
|
clearExpire, expire, expireAt, expireAt, remainTimeToLiveaddListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkreactor.core.publisher.Mono<String> acquire()
reactor.core.publisher.Mono<String> acquire(long leaseTime, TimeUnit unit)
leaseTime and return its id.
Waits if necessary until a permit became available.leaseTime - permit lease timeunit - time unitreactor.core.publisher.Mono<String> tryAcquire()
null
otherwisereactor.core.publisher.Mono<String> tryAcquire(long waitTime, TimeUnit unit)
waitTime if necessary until a permit became available.waitTime - the maximum time to waitunit - the time unitnull
if the waiting time elapsed before a permit was acquiredreactor.core.publisher.Mono<String> tryAcquire(long waitTime, long leaseTime, TimeUnit unit)
leaseTime and return its id.
Waits up to defined waitTime if necessary until a permit became available.waitTime - the maximum time to waitleaseTime - permit lease time, use -1 to make it permanentunit - the time unitnull
if the waiting time elapsed before a permit was acquiredreactor.core.publisher.Mono<Boolean> tryRelease(String permitId)
permitId - permit idtrue if a permit has been released and false
otherwisereactor.core.publisher.Mono<Void> release(String permitId)
permitId - - permit idreactor.core.publisher.Mono<Integer> availablePermits()
reactor.core.publisher.Mono<Boolean> trySetPermits(int permits)
permits - - number of permitstrue if permits has been set successfully, otherwise false.reactor.core.publisher.Mono<Void> addPermits(int permits)
permits - amount of permits to add/removereactor.core.publisher.Mono<Boolean> updateLeaseTime(String permitId, long leaseTime, TimeUnit unit)
permitId - permit idleaseTime - permit lease time, use -1 to make it permanentunit - the time unittrue if permits has been updated successfully, otherwise false.Copyright © 2014–2020 Redisson. All rights reserved.