public class RedissonPermitExpirableSemaphore extends RedissonObject implements RPermitExpirableSemaphore
codec, name| Constructor and Description |
|---|
RedissonPermitExpirableSemaphore(CommandAsyncExecutor commandExecutor,
String name) |
| Modifier and Type | Method and Description |
|---|---|
String |
acquire()
Acquires a permit and returns its id.
|
String |
acquire(long leaseTime,
TimeUnit timeUnit)
Acquires a permit with defined
leaseTime and return its id. |
RFuture<String> |
acquireAsync()
Acquires a permit and returns its id.
|
RFuture<String> |
acquireAsync(long leaseTime,
TimeUnit timeUnit)
Acquires a permit with defined
leaseTime and return its id. |
void |
addPermits(int permits)
Increases or decreases the number of available permits by defined value.
|
RFuture<Void> |
addPermitsAsync(int permits)
Increases or decreases the number of available permits by defined value.
|
int |
availablePermits()
Returns amount of available permits.
|
RFuture<Integer> |
availablePermitsAsync()
Returns amount of available permits.
|
boolean |
clearExpire()
Clear an expire timeout or expire date for object.
|
RFuture<Boolean> |
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.
|
protected RFuture<Boolean> |
clearExpireAsync(String... keys) |
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
boolean |
expire(Instant instant)
Set an expire date for object.
|
boolean |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(Instant instant)
Set an expire date for object.
|
RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in async mode.
|
protected RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit,
String... keys) |
boolean |
expireAt(Date timestamp)
Use
RExpirable.expire(Instant) instead |
boolean |
expireAt(long timestamp)
Use
RExpirable.expire(Instant) instead |
RFuture<Boolean> |
expireAtAsync(Date timestamp)
Use
RExpirableAsync.expireAsync(Instant) instead |
RFuture<Boolean> |
expireAtAsync(long timestamp)
Use
RExpirableAsync.expireAsync(Instant) instead |
protected RFuture<Boolean> |
expireAtAsync(long timestamp,
String... keys) |
protected String |
generateId() |
static String |
getChannelName(String name) |
void |
release(String permitId)
Releases a permit by its id.
|
RFuture<Void> |
releaseAsync(String permitId)
Releases a permit by its id.
|
long |
remainTimeToLive()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
sizeInMemoryAsync()
Returns bytes amount used by object in Redis memory.
|
String |
tryAcquire()
Tries to acquire currently available permit and return its id.
|
String |
tryAcquire(long waitTime,
long ttl,
TimeUnit unit)
Tries to acquire currently available permit
with defined
leaseTime and return its id. |
String |
tryAcquire(long waitTime,
TimeUnit unit)
Tries to acquire currently available permit and return its id.
|
RFuture<String> |
tryAcquireAsync()
Tries to acquire currently available permit and return its id.
|
RFuture<String> |
tryAcquireAsync(int permits,
long timeoutDate) |
RFuture<String> |
tryAcquireAsync(long waitTime,
long ttl,
TimeUnit unit)
Tries to acquire currently available permit
with defined
leaseTime and return its id. |
RFuture<String> |
tryAcquireAsync(long waitTime,
TimeUnit unit)
Tries to acquire currently available permit and return its id.
|
boolean |
tryRelease(String permitId)
Tries to release permit by its id.
|
RFuture<Boolean> |
tryReleaseAsync(String permitId)
Tries to release permit by its id.
|
boolean |
trySetPermits(int permits)
Tries to set number of permits.
|
RFuture<Boolean> |
trySetPermitsAsync(int permits)
Tries to set number of permits.
|
boolean |
updateLeaseTime(String permitId,
long leaseTime,
TimeUnit unit)
Overrides and updates lease time for defined permit id.
|
RFuture<Boolean> |
updateLeaseTimeAsync(String permitId,
long leaseTime,
TimeUnit unit)
Overrides and updates lease time for defined permit id.
|
addListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsyncclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearExpire, expire, expire, expireAt, expireAt, remainTimeToLiveaddListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkexpireAsync, expireAtAsync, remainTimeToLiveAsyncaddListenerAsync, copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsyncpublic RedissonPermitExpirableSemaphore(CommandAsyncExecutor commandExecutor, String name)
public String acquire() throws InterruptedException
RPermitExpirableSemaphoreacquire in interface RPermitExpirableSemaphoreInterruptedException - if the current thread is interruptedpublic String acquire(long leaseTime, TimeUnit timeUnit) throws InterruptedException
RPermitExpirableSemaphoreleaseTime and return its id.
Waits if necessary until a permit became available.acquire in interface RPermitExpirableSemaphoreleaseTime - permit lease timetimeUnit - time unitInterruptedException - if the current thread is interruptedpublic RFuture<String> acquireAsync(long leaseTime, TimeUnit timeUnit)
RPermitExpirableSemaphoreAsyncleaseTime and return its id.
Waits if necessary until a permit became available.acquireAsync in interface RPermitExpirableSemaphoreAsyncleaseTime - permit lease timetimeUnit - time unitpublic RFuture<String> acquireAsync()
RPermitExpirableSemaphoreAsyncacquireAsync in interface RPermitExpirableSemaphoreAsyncpublic String tryAcquire()
RPermitExpirableSemaphoretryAcquire in interface RPermitExpirableSemaphorenull
otherwisepublic RFuture<String> tryAcquireAsync()
RPermitExpirableSemaphoreAsynctryAcquireAsync in interface RPermitExpirableSemaphoreAsyncnull
otherwiseprotected String generateId()
public RFuture<String> tryAcquireAsync(long waitTime, TimeUnit unit)
RPermitExpirableSemaphoreAsyncwaitTime if necessary until a permit became available.tryAcquireAsync in interface RPermitExpirableSemaphoreAsyncwaitTime - the maximum time to waitunit - the time unitnull
if the waiting time elapsed before a permit was acquiredpublic String tryAcquire(long waitTime, long ttl, TimeUnit unit) throws InterruptedException
RPermitExpirableSemaphoreleaseTime and return its id.
Waits up to defined waitTime if necessary until a permit became available.tryAcquire in interface RPermitExpirableSemaphorewaitTime - the maximum time to waitttl - permit lease time, use -1 to make it permanentunit - the time unitnull
if the waiting time elapsed before a permit was acquiredInterruptedException - if the current thread is interruptedpublic RFuture<String> tryAcquireAsync(long waitTime, long ttl, TimeUnit unit)
RPermitExpirableSemaphoreAsyncleaseTime and return its id.
Waits up to defined waitTime if necessary until a permit became available.tryAcquireAsync in interface RPermitExpirableSemaphoreAsyncwaitTime - the maximum time to waitttl - permit lease time, use -1 to make it permanentunit - the time unitnull
if the waiting time elapsed before a permit was acquiredpublic String tryAcquire(long waitTime, TimeUnit unit) throws InterruptedException
RPermitExpirableSemaphorewaitTime if necessary until a permit became available.tryAcquire in interface RPermitExpirableSemaphorewaitTime - the maximum time to waitunit - the time unitnull
if the waiting time elapsed before a permit was acquiredInterruptedException - if the current thread is interruptedpublic void release(String permitId)
RPermitExpirableSemaphorerelease in interface RPermitExpirableSemaphorepermitId - - permit idpublic boolean tryRelease(String permitId)
RPermitExpirableSemaphoretryRelease in interface RPermitExpirableSemaphorepermitId - permit idtrue if a permit has been released and false
otherwisepublic RFuture<Boolean> tryReleaseAsync(String permitId)
RPermitExpirableSemaphoreAsynctryReleaseAsync in interface RPermitExpirableSemaphoreAsyncpermitId - permit idtrue if a permit has been released and false
otherwisepublic RFuture<Long> sizeInMemoryAsync()
RObjectAsyncsizeInMemoryAsync in interface RObjectAsyncsizeInMemoryAsync in class RedissonObjectpublic RFuture<Boolean> deleteAsync()
RObjectAsyncdeleteAsync in interface RObjectAsyncdeleteAsync in class RedissonObjecttrue if object was deleted false if notpublic RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
RExpirableAsyncexpireAsync in interface RExpirableAsynctimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsyncRExpirableAsync.expireAsync(Instant) insteadexpireAtAsync in interface RExpirableAsynctimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsyncclearExpireAsync in interface RExpirableAsynctrue if the timeout was cleared and false if notpublic RFuture<Void> releaseAsync(String permitId)
RPermitExpirableSemaphoreAsyncreleaseAsync in interface RPermitExpirableSemaphoreAsyncpermitId - - permit idpublic int availablePermits()
RPermitExpirableSemaphoreavailablePermits in interface RPermitExpirableSemaphorepublic RFuture<Integer> availablePermitsAsync()
RPermitExpirableSemaphoreAsyncavailablePermitsAsync in interface RPermitExpirableSemaphoreAsyncpublic boolean trySetPermits(int permits)
RPermitExpirableSemaphoretrySetPermits in interface RPermitExpirableSemaphorepermits - - number of permitstrue if permits has been set successfully, otherwise false.public RFuture<Boolean> trySetPermitsAsync(int permits)
RPermitExpirableSemaphoreAsynctrySetPermitsAsync in interface RPermitExpirableSemaphoreAsyncpermits - - number of permitstrue if permits has been set successfully, otherwise false.public void addPermits(int permits)
RPermitExpirableSemaphoreaddPermits in interface RPermitExpirableSemaphorepermits - amount of permits to add/removepublic RFuture<Void> addPermitsAsync(int permits)
RPermitExpirableSemaphoreAsyncaddPermitsAsync in interface RPermitExpirableSemaphoreAsyncpermits - amount of permits to add/removepublic RFuture<Boolean> updateLeaseTimeAsync(String permitId, long leaseTime, TimeUnit unit)
RPermitExpirableSemaphoreAsyncupdateLeaseTimeAsync in interface RPermitExpirableSemaphoreAsyncpermitId - permit idleaseTime - permit lease time, use -1 to make it permanentunit - the time unittrue if permits has been updated successfully, otherwise false.public boolean updateLeaseTime(String permitId, long leaseTime, TimeUnit unit)
RPermitExpirableSemaphoreupdateLeaseTime in interface RPermitExpirableSemaphorepermitId - permit idleaseTime - permit lease time, use -1 to make it permanentunit - the time unittrue if permits has been updated successfully, otherwise false.public boolean expire(long timeToLive,
TimeUnit timeUnit)
RExpirableexpire in interface RExpirabletimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic boolean expireAt(long timestamp)
RExpirableRExpirable.expire(Instant) insteadexpireAt in interface RExpirabletimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic boolean expire(Instant instant)
RExpirableexpire in interface RExpirableinstant - - expire datetrue if the timeout was set and false if notpublic RFuture<Boolean> expireAsync(Instant instant)
RExpirableAsyncexpireAsync in interface RExpirableAsyncinstant - - expire datetrue if the timeout was set and false if notpublic boolean expireAt(Date timestamp)
RExpirableRExpirable.expire(Instant) insteadexpireAt in interface RExpirabletimestamp - - expire datetrue if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsyncRExpirableAsync.expireAsync(Instant) insteadexpireAtAsync in interface RExpirableAsynctimestamp - - expire datetrue if the timeout was set and false if notpublic boolean clearExpire()
RExpirableclearExpire in interface RExpirabletrue if timeout was removed
false if object does not exist or does not have an associated timeoutpublic long remainTimeToLive()
RExpirableremainTimeToLive in interface RExpirablepublic RFuture<Long> remainTimeToLiveAsync()
RExpirableAsyncremainTimeToLiveAsync in interface RExpirableAsyncprotected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2021 Redisson. All rights reserved.