public interface RSemaphoreAsync extends RExpirableAsync
Semaphore
.
Works in non-fair mode. Therefore order of acquiring is unpredictable.Modifier and Type | Method and Description |
---|---|
io.netty.util.concurrent.Future<Void> |
acquireAsync()
Acquires a permit from this semaphore.
|
io.netty.util.concurrent.Future<Void> |
acquireAsync(int permits)
Acquires the given number of permits, if they are available,
and returns immediately, reducing the number of available permits
by the given amount.
|
io.netty.util.concurrent.Future<Void> |
releaseAsync()
Releases a permit, returning it to the semaphore.
|
io.netty.util.concurrent.Future<Void> |
releaseAsync(int permits)
Releases the given number of permits, returning them to the semaphore.
|
io.netty.util.concurrent.Future<Void> |
setPermitsAsync(int permits)
Sets new number of permits.
|
io.netty.util.concurrent.Future<Boolean> |
tryAcquireAsync()
Acquires a permit only if one is available at the
time of invocation.
|
io.netty.util.concurrent.Future<Boolean> |
tryAcquireAsync(int permits)
Acquires the given number of permits only if all are available at the
time of invocation.
|
io.netty.util.concurrent.Future<Boolean> |
tryAcquireAsync(int permits,
long waitTime,
TimeUnit unit)
Acquires the given number of permits only if all are available
within the given waiting time.
|
io.netty.util.concurrent.Future<Boolean> |
tryAcquireAsync(long waitTime,
TimeUnit unit)
Acquires a permit, if one is available and returns immediately,
with the value
true ,
reducing the number of available permits by one. |
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
deleteAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync
io.netty.util.concurrent.Future<Boolean> tryAcquireAsync()
Acquires a permit, if one is available and returns immediately,
with the value true
,
reducing the number of available permits by one.
If no permit is available then this method will return
immediately with the value false
.
true
if a permit was acquired and false
otherwiseio.netty.util.concurrent.Future<Boolean> tryAcquireAsync(int permits)
Acquires a permits, if all are available and returns immediately,
with the value true
,
reducing the number of available permits by given number of permitss.
If no permits are available then this method will return
immediately with the value false
.
permits
- the number of permits to acquiretrue
if a permit was acquired and false
otherwiseio.netty.util.concurrent.Future<Void> acquireAsync()
Acquires a permit, if one is available and returns immediately, reducing the number of available permits by one.
io.netty.util.concurrent.Future<Void> acquireAsync(int permits)
permits
- the number of permits to acquireIllegalArgumentException
- if permits
is negativeio.netty.util.concurrent.Future<Void> releaseAsync()
Releases 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 #acquire
.
Correct usage of a semaphore is established by programming convention
in the application.
io.netty.util.concurrent.Future<Void> releaseAsync(int permits)
Releases the given number of permits, increasing the number of available permits by the given number of permits. If any threads of Redisson client are trying to acquire a permits, then next threads is selected and tries to acquire the permits that was just released.
There is no requirement that a thread that releases a permits must
have acquired that permit by calling #acquire
.
Correct usage of a semaphore is established by programming convention
in the application.
io.netty.util.concurrent.Future<Void> setPermitsAsync(int permits)
count
- - number of times #countDown
must be invoked
before threads can pass through #await
io.netty.util.concurrent.Future<Boolean> tryAcquireAsync(long waitTime, TimeUnit unit)
Acquires a permit, if one is available and returns immediately,
with the value true
,
reducing the number of available permits by one.
If a permit is acquired then the value true
is returned.
If the specified waiting time elapses then the value false
is returned. If the time is less than or equal to zero, the method
will not wait at all.
waitTime
- the maximum time to wait for a permitunit
- the time unit of the timeout
argumenttrue
if a permit was acquired and false
if the waiting time elapsed before a permit was acquiredio.netty.util.concurrent.Future<Boolean> tryAcquireAsync(int permits, long waitTime, TimeUnit unit)
Acquires a permits, if all are available and returns immediately,
with the value true
,
reducing the number of available permits by one.
If a permits is acquired then the value true
is returned.
If the specified waiting time elapses then the value false
is returned. If the time is less than or equal to zero, the method
will not wait at all.
permits
- waitTime
- the maximum time to wait for a available permitsunit
- the time unit of the timeout
argumenttrue
if a permit was acquired and false
if the waiting time elapsed before a permit was acquiredInterruptedException
- if the current thread is interruptedCopyright © 2014–2016. All rights reserved.