public interface RSemaphoreReactive extends RExpirableReactive
Semaphore
.
Works in non-fair mode. Therefore order of acquiring is unpredictable.
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
acquire()
Acquires a permit.
|
reactor.core.publisher.Mono<Void> |
acquire(int permits)
Acquires defined amount of
permits . |
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<Integer> |
drainPermits()
Acquires and returns all permits that are immediately available.
|
reactor.core.publisher.Mono<Void> |
release()
Releases a permit.
|
reactor.core.publisher.Mono<Void> |
release(int permits)
Releases defined amount of
permits . |
reactor.core.publisher.Mono<Boolean> |
tryAcquire()
Acquires a permit.
|
reactor.core.publisher.Mono<Boolean> |
tryAcquire(int permits)
Tries to acquire defined amount of currently available
permits . |
reactor.core.publisher.Mono<Boolean> |
tryAcquire(int permits,
long waitTime,
TimeUnit unit)
Tries to acquire defined amount of currently available
permits . |
reactor.core.publisher.Mono<Boolean> |
tryAcquire(long waitTime,
TimeUnit unit)
Tries to acquire currently available permit.
|
reactor.core.publisher.Mono<Boolean> |
trySetPermits(int permits)
Tries to set number of permits.
|
clearExpire, expire, expireAt, expireAt, remainTimeToLive
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
reactor.core.publisher.Mono<Boolean> tryAcquire()
true
if a permit was acquired and false
otherwisereactor.core.publisher.Mono<Boolean> tryAcquire(int permits)
permits
.permits
- the number of permits to acquiretrue
if permits were acquired and false
otherwisereactor.core.publisher.Mono<Void> acquire()
reactor.core.publisher.Mono<Void> acquire(int permits)
permits
.
Waits if necessary until all permits became available.permits
- the number of permits to acquireIllegalArgumentException
- if permits
is negativereactor.core.publisher.Mono<Void> release()
reactor.core.publisher.Mono<Void> release(int permits)
permits
.permits
- amountreactor.core.publisher.Mono<Boolean> trySetPermits(int permits)
permits
- - number of permitstrue
if permits has been set successfully, otherwise false
.reactor.core.publisher.Mono<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
otherwisereactor.core.publisher.Mono<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
otherwisereactor.core.publisher.Mono<Void> addPermits(int permits)
permits
- amount of permits to add/removereactor.core.publisher.Mono<Integer> availablePermits()
reactor.core.publisher.Mono<Integer> drainPermits()
Copyright © 2014–2021 Redisson. All rights reserved.