public class RedissonPermitExpirableSemaphoreReactive extends Object implements RPermitExpirableSemaphoreReactive
| Constructor and Description |
|---|
RedissonPermitExpirableSemaphoreReactive(CommandReactiveExecutor connectionManager,
String name,
SemaphorePubSub semaphorePubSub) |
| Modifier and Type | Method and Description |
|---|---|
org.reactivestreams.Publisher<String> |
acquire()
Acquires a permit from this semaphore, blocking until one is
available, or the thread is interrupted.
|
org.reactivestreams.Publisher<String> |
acquire(long leaseTime,
TimeUnit unit)
Acquires a permit with defined lease time from this semaphore,
blocking until one is available,
or the thread is interrupted.
|
org.reactivestreams.Publisher<Void> |
addPermits(int permits)
Increases or decreases the number of available permits by defined value.
|
org.reactivestreams.Publisher<Integer> |
availablePermits()
Returns the current number of available permits.
|
org.reactivestreams.Publisher<Boolean> |
clearExpire()
Clear an expire timeout or expire date for object in mode.
|
protected RLockAsync |
createLock(CommandAsyncExecutor connectionManager,
String name) |
org.reactivestreams.Publisher<Boolean> |
delete()
Delete object in mode
|
protected void |
encode(Collection<Object> params,
Collection<?> values) |
protected io.netty.buffer.ByteBuf |
encode(Object value) |
protected io.netty.buffer.ByteBuf |
encodeMapKey(Object value) |
protected io.netty.buffer.ByteBuf |
encodeMapValue(Object value) |
org.reactivestreams.Publisher<Boolean> |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in mode.
|
org.reactivestreams.Publisher<Boolean> |
expireAt(Date timestamp)
Set an expire date for object in mode.
|
org.reactivestreams.Publisher<Boolean> |
expireAt(long timestamp)
Set an expire date for object in mode.
|
Codec |
getCodec() |
String |
getName() |
org.reactivestreams.Publisher<Boolean> |
isExists()
Check object existence
|
org.reactivestreams.Publisher<Void> |
migrate(String host,
int port,
int database,
long timeout)
Transfer a object from a source Redis instance to a destination Redis instance
in mode
|
org.reactivestreams.Publisher<Boolean> |
move(int database)
Move object to another database in mode
|
protected <V> reactor.core.publisher.Mono<V> |
newSucceeded(V result) |
<R> org.reactivestreams.Publisher<R> |
reactive(Supplier<RFuture<R>> supplier) |
org.reactivestreams.Publisher<Void> |
release(String permitId)
Releases a permit by its id, returning it to the semaphore.
|
org.reactivestreams.Publisher<Long> |
remainTimeToLive()
Get remaining time to live of object in milliseconds.
|
org.reactivestreams.Publisher<Void> |
rename(String newName)
Rename current object key to
newName
in mode |
org.reactivestreams.Publisher<Boolean> |
renamenx(String newName)
Rename current object key to
newName
in mode only if new key is not exists |
org.reactivestreams.Publisher<String> |
tryAcquire()
Acquires a permit only if one is available at the
time of invocation.
|
org.reactivestreams.Publisher<String> |
tryAcquire(long waitTime,
long leaseTime,
TimeUnit unit)
Acquires a permit with defined lease time from this semaphore,
if one becomes available
within the given waiting time and the current thread has not
been interrupted.
|
org.reactivestreams.Publisher<String> |
tryAcquire(long waitTime,
TimeUnit unit)
Acquires a permit from this semaphore, if one becomes available
within the given waiting time and the current thread has not
been interrupted.
|
org.reactivestreams.Publisher<Boolean> |
tryRelease(String permitId)
Releases a permit by its id, returning it to the semaphore.
|
org.reactivestreams.Publisher<Boolean> |
trySetPermits(int permits)
Sets number of permits.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearExpire, expire, expireAt, expireAt, remainTimeToLivepublic RedissonPermitExpirableSemaphoreReactive(CommandReactiveExecutor connectionManager, String name, SemaphorePubSub semaphorePubSub)
protected RLockAsync createLock(CommandAsyncExecutor connectionManager, String name)
public org.reactivestreams.Publisher<String> acquire()
RPermitExpirableSemaphoreReactiveAcquires a permit, if one is available and returns its id, reducing the number of available permits by one.
If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
RPermitExpirableSemaphoreReactive.release(String) method for this
semaphore and the current thread is next to be assigned a permit; or
acquire in interface RPermitExpirableSemaphoreReactivepublic org.reactivestreams.Publisher<String> acquire(long leaseTime, TimeUnit unit)
RPermitExpirableSemaphoreReactiveAcquires a permit, if one is available and returns its id, reducing the number of available permits by one.
If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
RPermitExpirableSemaphoreReactive.release(java.lang.String) method for this
semaphore and the current thread is next to be assigned a permit; or
acquire in interface RPermitExpirableSemaphoreReactiveleaseTime - - permit lease timeunit - - time unitpublic org.reactivestreams.Publisher<String> tryAcquire()
RPermitExpirableSemaphoreReactiveAcquires a permit, if one is available and returns immediately, with the permit id, reducing the number of available permits by one.
If no permit is available then this method will return
immediately with the value null.
tryAcquire in interface RPermitExpirableSemaphoreReactivenull
otherwisepublic org.reactivestreams.Publisher<String> tryAcquire(long waitTime, TimeUnit unit)
RPermitExpirableSemaphoreReactiveAcquires a permit, if one is available and returns immediately, with the permit id, reducing the number of available permits by one.
If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
RPermitExpirableSemaphoreReactive.release(String) method for this
semaphore and the current thread is next to be assigned a permit; or
If a permit is acquired then the permit id is returned.
If the specified waiting time elapses then the value null
is returned. If the time is less than or equal to zero, the method
will not wait at all.
tryAcquire in interface RPermitExpirableSemaphoreReactivewaitTime - the maximum time to wait for a permitunit - the time unit of the timeout argumentnull
if the waiting time elapsed before a permit was acquiredpublic org.reactivestreams.Publisher<String> tryAcquire(long waitTime, long leaseTime, TimeUnit unit)
RPermitExpirableSemaphoreReactiveAcquires a permit, if one is available and returns immediately, with the permit id, reducing the number of available permits by one.
If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
RPermitExpirableSemaphoreReactive.release(String) method for this
semaphore and the current thread is next to be assigned a permit; or
If a permit is acquired then the permit id is returned.
If the specified waiting time elapses then the value null
is returned. If the time is less than or equal to zero, the method
will not wait at all.
tryAcquire in interface RPermitExpirableSemaphoreReactivewaitTime - the maximum time to wait for a permitleaseTime - permit lease timeunit - the time unit of the timeout argumentnull
if the waiting time elapsed before a permit was acquiredpublic org.reactivestreams.Publisher<Boolean> tryRelease(String permitId)
RPermitExpirableSemaphoreReactiveReleases a permit, increasing the number of available permits by one. If any threads of Redisson client are trying to acquire a permit, then one is selected and given the permit that was just released.
There is no requirement that a thread that releases a permit must
have acquired that permit by calling RPermitExpirableSemaphoreReactive.acquire().
Correct usage of a semaphore is established by programming convention
in the application.
tryRelease in interface RPermitExpirableSemaphoreReactivepermitId - - permit idtrue if a permit has been released and false
otherwisepublic org.reactivestreams.Publisher<Void> release(String permitId)
RPermitExpirableSemaphoreReactiveReleases a permit, increasing the number of available permits by one. If any threads of Redisson client are trying to acquire a permit, then one is selected and given the permit that was just released.
There is no requirement that a thread that releases a permit must
have acquired that permit by calling RPermitExpirableSemaphoreReactive.acquire().
Correct usage of a semaphore is established by programming convention
in the application.
Throws an exception if permit id doesn't exist or has already been release
release in interface RPermitExpirableSemaphoreReactivepermitId - - permit idpublic org.reactivestreams.Publisher<Integer> availablePermits()
RPermitExpirableSemaphoreReactiveavailablePermits in interface RPermitExpirableSemaphoreReactivepublic org.reactivestreams.Publisher<Boolean> trySetPermits(int permits)
RPermitExpirableSemaphoreReactivetrySetPermits in interface RPermitExpirableSemaphoreReactivepermits - - number of permitstrue if permits has been set successfully, otherwise false.public org.reactivestreams.Publisher<Void> addPermits(int permits)
RPermitExpirableSemaphoreReactiveaddPermits in interface RPermitExpirableSemaphoreReactivepermits - - number of permits to add/removepublic org.reactivestreams.Publisher<Boolean> expire(long timeToLive, TimeUnit timeUnit)
RExpirableReactiveexpire in interface RExpirableReactivetimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic org.reactivestreams.Publisher<Boolean> expireAt(long timestamp)
RExpirableReactiveexpireAt in interface RExpirableReactivetimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic org.reactivestreams.Publisher<Boolean> expireAt(Date timestamp)
RExpirableReactiveexpireAt in interface RExpirableReactivetimestamp - - expire datetrue if the timeout was set and false if notpublic org.reactivestreams.Publisher<Boolean> clearExpire()
RExpirableReactiveclearExpire in interface RExpirableReactivetrue if the timeout was cleared and false if notpublic org.reactivestreams.Publisher<Long> remainTimeToLive()
RExpirableReactiveremainTimeToLive in interface RExpirableReactiveprotected <V> reactor.core.publisher.Mono<V> newSucceeded(V result)
public String getName()
getName in interface RObjectReactivepublic Codec getCodec()
getCodec in interface RObjectReactiveprotected void encode(Collection<Object> params, Collection<?> values)
protected io.netty.buffer.ByteBuf encode(Object value)
protected io.netty.buffer.ByteBuf encodeMapKey(Object value)
protected io.netty.buffer.ByteBuf encodeMapValue(Object value)
public org.reactivestreams.Publisher<Void> rename(String newName)
RObjectReactivenewName
in moderename in interface RObjectReactivenewName - - new name of objectpublic org.reactivestreams.Publisher<Void> migrate(String host, int port, int database, long timeout)
RObjectReactivemigrate in interface RObjectReactivehost - - destination hostport - - destination portdatabase - - destination databasetimeout - - maximum idle time in any moment of the communication with the destination instance in millisecondspublic org.reactivestreams.Publisher<Boolean> move(int database)
RObjectReactivemove in interface RObjectReactivedatabase - - number of Redis databasetrue if key was moved false if notpublic org.reactivestreams.Publisher<Boolean> renamenx(String newName)
RObjectReactivenewName
in mode only if new key is not existsrenamenx in interface RObjectReactivenewName - - new name of objecttrue if object has been renamed successfully and false otherwisepublic org.reactivestreams.Publisher<Boolean> delete()
RObjectReactivedelete in interface RObjectReactivetrue if object was deleted false if notpublic org.reactivestreams.Publisher<Boolean> isExists()
RObjectReactiveisExists in interface RObjectReactivetrue if object exists and false otherwiseCopyright © 2014–2018 The Redisson Project. All rights reserved.