javadocs updated

pull/2452/merge
Nikita Koksharov 5 years ago
parent d7d4a4850d
commit 7838147444

@ -31,62 +31,27 @@ import java.util.concurrent.TimeUnit;
public interface RPermitExpirableSemaphore extends RExpirable, RPermitExpirableSemaphoreAsync {
/**
* Acquires a permit from this semaphore, blocking until one is
* available, or the thread is {@linkplain Thread#interrupt interrupted}.
* Acquires a permit and returns its id.
* Waits if necessary until a permit became available.
*
* <p>Acquires a permit, if one is available and returns its id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of two things happens:
* <ul>
* <li>Some other thread invokes the {@link #release} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread.
* </ul>
*
* @return permit id
* @throws InterruptedException if the current thread is interrupted
*/
String acquire() throws InterruptedException;
/**
* Acquires a permit with defined lease time from this semaphore,
* blocking until one is available,
* or the thread is {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns its id,
* reducing the number of available permits by one.
* Acquires a permit with defined <code>leaseTime</code> and return its id.
* Waits if necessary until a permit became available.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of two things happens:
* <ul>
* <li>Some other thread invokes the {@link #release} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread.
* </ul>
*
* @param leaseTime - permit lease time
* @param unit - time unit
* @param leaseTime permit lease time
* @param unit time unit
* @return permit id
* @throws InterruptedException if the current thread is interrupted
*/
String acquire(long leaseTime, TimeUnit unit) throws InterruptedException;
/**
* Acquires a permit only if one is available at the
* time of invocation.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then this method will return
* immediately with the value {@code null}.
* Tries to acquire currently available permit and return its id.
*
* @return permit id if a permit was acquired and {@code null}
* otherwise
@ -94,33 +59,11 @@ public interface RPermitExpirableSemaphore extends RExpirable, RPermitExpirableS
String tryAcquire();
/**
* Acquires a permit from this semaphore, if one becomes available
* within the given waiting time and the current thread has not
* been {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of three things happens:
* <ul>
* <li>Some other thread invokes the {@link #release} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread; or
* <li>The specified waiting time elapses.
* </ul>
*
* <p>If a permit is acquired then the permit id is returned.
*
* <p>If the specified waiting time elapses then the value {@code null}
* is returned. If the time is less than or equal to zero, the method
* will not wait at all.
* Tries to acquire currently available permit and return its id.
* Waits up to defined <code>waitTime</code> if necessary until a permit became available.
*
* @param waitTime the maximum time to wait for a permit
* @param unit the time unit of the {@code timeout} argument
* @param waitTime the maximum time to wait
* @param unit the time unit
* @return permit id if a permit was acquired and {@code null}
* if the waiting time elapsed before a permit was acquired
* @throws InterruptedException if the current thread is interrupted
@ -128,86 +71,45 @@ public interface RPermitExpirableSemaphore extends RExpirable, RPermitExpirableS
String tryAcquire(long waitTime, TimeUnit unit) throws InterruptedException;
/**
* 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 {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of three things happens:
* <ul>
* <li>Some other thread invokes the {@link #release} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread; or
* <li>The specified waiting time elapses.
* </ul>
*
* <p>If a permit is acquired then the permit id is returned.
*
* <p>If the specified waiting time elapses then the value {@code null}
* is returned. If the time is less than or equal to zero, the method
* will not wait at all.
* Tries to acquire currently available permit
* with defined <code>leaseTime</code> and return its id.
* Waits up to defined <code>waitTime</code> if necessary until a permit became available.
*
* @param waitTime the maximum time to wait for a permit
* @param waitTime the maximum time to wait
* @param leaseTime permit lease time, use -1 to make it permanent
* @param unit the time unit of the {@code timeout} argument
* @return permit id if a permit was acquired and {@code null}
* @param unit the time unit
* @return permit id if a permit was acquired and <code>null</code>
* if the waiting time elapsed before a permit was acquired
* @throws InterruptedException if the current thread is interrupted
*/
String tryAcquire(long waitTime, long leaseTime, TimeUnit unit) throws InterruptedException;
/**
* Releases a permit by its id, returning it to the semaphore.
* Tries to release permit by its id.
*
* <p>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.
*
* <p>There is no requirement that a thread that releases a permit must
* have acquired that permit by calling {@link #acquire}.
* Correct usage of a semaphore is established by programming convention
* in the application.
*
* @param permitId - permit id
* @return {@code true} if a permit has been released and {@code false}
* @param permitId permit id
* @return <code>true</code> if a permit has been released and <code>false</code>
* otherwise
*/
boolean tryRelease(String permitId);
/**
* Releases a permit by its id, returning it to the semaphore.
*
* <p>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.
*
* <p>There is no requirement that a thread that releases a permit must
* have acquired that permit by calling {@link #acquire}.
* Correct usage of a semaphore is established by programming convention
* in the application.
*
* <p>Throws an exception if permit id doesn't exist or has already been release
* Releases a permit by its id. Increases the number of available permits.
* Throws an exception if permit id doesn't exist or has already been released.
*
* @param permitId - permit id
*/
void release(String permitId);
/**
* Returns the current number of available permits.
* Returns amount of available permits.
*
* @return number of available permits
* @return number of permits
*/
int availablePermits();
/**
* Sets number of permits.
* Tries to set number of permits.
*
* @param permits - number of permits
* @return <code>true</code> if permits has been set successfully, otherwise <code>false</code>.
@ -217,16 +119,16 @@ public interface RPermitExpirableSemaphore extends RExpirable, RPermitExpirableS
/**
* Increases or decreases the number of available permits by defined value.
*
* @param permits - number of permits to add/remove
* @param permits amount of permits to add/remove
*/
void addPermits(int permits);
/**
* Overrides and updates lease time for defined permit id.
*
* @param permitId - permit id
* @param leaseTime - permit lease time, use -1 to make it permanent
* @param unit - the time unit of the {@code timeout} argument
* @param permitId permit id
* @param leaseTime permit lease time, use -1 to make it permanent
* @param unit the time unit
* @return <code>true</code> if permits has been updated successfully, otherwise <code>false</code>.
*/
boolean updateLeaseTime(String permitId, long leaseTime, TimeUnit unit);

@ -31,60 +31,25 @@ import java.util.concurrent.TimeUnit;
public interface RPermitExpirableSemaphoreAsync extends RExpirableAsync {
/**
* Acquires a permit from this semaphore, blocking until one is
* available, or the thread is {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns its id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of two things happens:
* <ul>
* <li>Some other thread invokes the {@link #releaseAsync(String)} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread.
* </ul>
* Acquires a permit and returns its id.
* Waits if necessary until a permit became available.
*
* @return permit id
*/
RFuture<String> acquireAsync();
/**
* Acquires a permit with defined lease time from this semaphore,
* blocking until one is available,
* or the thread is {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns its id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of two things happens:
* <ul>
* <li>Some other thread invokes the {@link #releaseAsync} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread.
* </ul>
* Acquires a permit with defined <code>leaseTime</code> and return its id.
* Waits if necessary until a permit became available.
*
* @param leaseTime - permit lease time
* @param unit - time unit
* @param leaseTime permit lease time
* @param unit time unit
* @return permit id
*/
RFuture<String> acquireAsync(long leaseTime, TimeUnit unit);
/**
* Acquires a permit only if one is available at the
* time of invocation.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then this method will return
* immediately with the value {@code null}.
* Tries to acquire currently available permit and return its id.
*
* @return permit id if a permit was acquired and {@code null}
* otherwise
@ -92,104 +57,41 @@ public interface RPermitExpirableSemaphoreAsync extends RExpirableAsync {
RFuture<String> tryAcquireAsync();
/**
* Acquires a permit from this semaphore, if one becomes available
* within the given waiting time and the current thread has not
* been {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of three things happens:
* <ul>
* <li>Some other thread invokes the {@link #releaseAsync(String)} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread; or
* <li>The specified waiting time elapses.
* </ul>
*
* <p>If a permit is acquired then the permit id is returned.
*
* <p>If the specified waiting time elapses then the value {@code null}
* is returned. If the time is less than or equal to zero, the method
* will not wait at all.
* Tries to acquire currently available permit and return its id.
* Waits up to defined <code>waitTime</code> if necessary until a permit became available.
*
* @param waitTime the maximum time to wait for a permit
* @param unit the time unit of the {@code timeout} argument
* @param waitTime the maximum time to wait
* @param unit the time unit
* @return permit id if a permit was acquired and {@code null}
* if the waiting time elapsed before a permit was acquired
*/
RFuture<String> tryAcquireAsync(long waitTime, 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 {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of three things happens:
* <ul>
* <li>Some other thread invokes the {@link #releaseAsync(String)} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread; or
* <li>The specified waiting time elapses.
* </ul>
*
* <p>If a permit is acquired then the permit id is returned.
*
* <p>If the specified waiting time elapses then the value {@code null}
* is returned. If the time is less than or equal to zero, the method
* will not wait at all.
* Tries to acquire currently available permit
* with defined <code>leaseTime</code> and return its id.
* Waits up to defined <code>waitTime</code> if necessary until a permit became available.
*
* @param waitTime the maximum time to wait for a permit
* @param waitTime the maximum time to wait
* @param leaseTime permit lease time, use -1 to make it permanent
* @param unit the time unit of the {@code timeout} argument
* @return permit id if a permit was acquired and {@code null}
* @param unit the time unit
* @return permit id if a permit was acquired and <code>null</code>
* if the waiting time elapsed before a permit was acquired
*/
RFuture<String> tryAcquireAsync(long waitTime, long leaseTime, TimeUnit unit);
/**
* Releases a permit by its id, returning it to the semaphore.
* Tries to release permit by its id.
*
* <p>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.
*
* <p>There is no requirement that a thread that releases a permit must
* have acquired that permit by calling {@link #acquireAsync()}.
* Correct usage of a semaphore is established by programming convention
* in the application.
*
* @param permitId - permit id
* @return {@code true} if a permit has been released and {@code false}
* @param permitId permit id
* @return <code>true</code> if a permit has been released and <code>false</code>
* otherwise
*/
RFuture<Boolean> tryReleaseAsync(String permitId);
/**
* Releases a permit by its id, returning it to the semaphore.
*
* <p>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.
*
* <p>There is no requirement that a thread that releases a permit must
* have acquired that permit by calling {@link #acquireAsync()}.
* Correct usage of a semaphore is established by programming convention
* in the application.
*
* <p>Throws an exception if permit id doesn't exist or has already been release
* Releases a permit by its id. Increases the number of available permits.
* Throws an exception if permit id doesn't exist or has already been released.
*
* @param permitId - permit id
* @return void
@ -197,14 +99,14 @@ public interface RPermitExpirableSemaphoreAsync extends RExpirableAsync {
RFuture<Void> releaseAsync(String permitId);
/**
* Returns the current number of available permits.
* Returns amount of available permits.
*
* @return number of available permits
* @return number of permits
*/
RFuture<Integer> availablePermitsAsync();
/**
* Sets number of permits.
* Tries to set number of permits.
*
* @param permits - number of permits
* @return <code>true</code> if permits has been set successfully, otherwise <code>false</code>.
@ -214,7 +116,7 @@ public interface RPermitExpirableSemaphoreAsync extends RExpirableAsync {
/**
* Increases or decreases the number of available permits by defined value.
*
* @param permits - number of permits to add/remove
* @param permits amount of permits to add/remove
* @return void
*/
RFuture<Void> addPermitsAsync(int permits);
@ -222,9 +124,9 @@ public interface RPermitExpirableSemaphoreAsync extends RExpirableAsync {
/**
* Overrides and updates lease time for defined permit id.
*
* @param permitId - permit id
* @param leaseTime - permit lease time, use -1 to make it permanent
* @param unit - the time unit of the {@code timeout} argument
* @param permitId permit id
* @param leaseTime permit lease time, use -1 to make it permanent
* @param unit the time unit
* @return <code>true</code> if permits has been updated successfully, otherwise <code>false</code>.
*/
RFuture<Boolean> updateLeaseTimeAsync(String permitId, long leaseTime, TimeUnit unit);

@ -33,60 +33,25 @@ import reactor.core.publisher.Mono;
public interface RPermitExpirableSemaphoreReactive extends RExpirableReactive {
/**
* Acquires a permit from this semaphore, blocking until one is
* available, or the thread is {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns its id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of two things happens:
* <ul>
* <li>Some other thread invokes the {@link #release(String)} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread.
* </ul>
* Acquires a permit and returns its id.
* Waits if necessary until a permit became available.
*
* @return permit id
*/
Mono<String> acquire();
/**
* Acquires a permit with defined lease time from this semaphore,
* blocking until one is available,
* or the thread is {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns its id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of two things happens:
* <ul>
* <li>Some other thread invokes the {@link #release} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread.
* </ul>
* Acquires a permit with defined <code>leaseTime</code> and return its id.
* Waits if necessary until a permit became available.
*
* @param leaseTime - permit lease time
* @param unit - time unit
* @param leaseTime permit lease time
* @param unit time unit
* @return permit id
*/
Mono<String> acquire(long leaseTime, TimeUnit unit);
/**
* Acquires a permit only if one is available at the
* time of invocation.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then this method will return
* immediately with the value {@code null}.
* Tries to acquire currently available permit and return its id.
*
* @return permit id if a permit was acquired and {@code null}
* otherwise
@ -94,104 +59,41 @@ public interface RPermitExpirableSemaphoreReactive extends RExpirableReactive {
Mono<String> tryAcquire();
/**
* Acquires a permit from this semaphore, if one becomes available
* within the given waiting time and the current thread has not
* been {@linkplain Thread#interrupt interrupted}.
* Tries to acquire currently available permit and return its id.
* Waits up to defined <code>waitTime</code> if necessary until a permit became available.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of three things happens:
* <ul>
* <li>Some other thread invokes the {@link #release(String)} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread; or
* <li>The specified waiting time elapses.
* </ul>
*
* <p>If a permit is acquired then the permit id is returned.
*
* <p>If the specified waiting time elapses then the value {@code null}
* is returned. If the time is less than or equal to zero, the method
* will not wait at all.
*
* @param waitTime the maximum time to wait for a permit
* @param unit the time unit of the {@code timeout} argument
* @param waitTime the maximum time to wait
* @param unit the time unit
* @return permit id if a permit was acquired and {@code null}
* if the waiting time elapsed before a permit was acquired
*/
Mono<String> tryAcquire(long waitTime, 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 {@linkplain Thread#interrupt interrupted}.
*
* <p>Acquires a permit, if one is available and returns immediately,
* with the permit id,
* reducing the number of available permits by one.
*
* <p>If no permit is available then the current thread becomes
* disabled for thread scheduling purposes and lies dormant until
* one of three things happens:
* <ul>
* <li>Some other thread invokes the {@link #release(String)} method for this
* semaphore and the current thread is next to be assigned a permit; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread; or
* <li>The specified waiting time elapses.
* </ul>
*
* <p>If a permit is acquired then the permit id is returned.
*
* <p>If the specified waiting time elapses then the value {@code null}
* is returned. If the time is less than or equal to zero, the method
* will not wait at all.
*
* @param waitTime the maximum time to wait for a permit
* @param leaseTime permit lease time
* @param unit the time unit of the {@code timeout} argument
* @return permit id if a permit was acquired and {@code null}
* Tries to acquire currently available permit
* with defined <code>leaseTime</code> and return its id.
* Waits up to defined <code>waitTime</code> if necessary until a permit became available.
*
* @param waitTime the maximum time to wait
* @param leaseTime permit lease time, use -1 to make it permanent
* @param unit the time unit
* @return permit id if a permit was acquired and <code>null</code>
* if the waiting time elapsed before a permit was acquired
*/
Mono<String> tryAcquire(long waitTime, long leaseTime, TimeUnit unit);
/**
* Releases a permit by its id, returning it to the semaphore.
*
* <p>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.
* Tries to release permit by its id.
*
* <p>There is no requirement that a thread that releases a permit must
* have acquired that permit by calling {@link #acquire()}.
* Correct usage of a semaphore is established by programming convention
* in the application.
*
* @param permitId - permit id
* @return {@code true} if a permit has been released and {@code false}
* @param permitId permit id
* @return <code>true</code> if a permit has been released and <code>false</code>
* otherwise
*/
Mono<Boolean> tryRelease(String permitId);
/**
* Releases a permit by its id, returning it to the semaphore.
*
* <p>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.
*
* <p>There is no requirement that a thread that releases a permit must
* have acquired that permit by calling {@link #acquire()}.
* Correct usage of a semaphore is established by programming convention
* in the application.
*
* <p>Throws an exception if permit id doesn't exist or has already been release
* Releases a permit by its id. Increases the number of available permits.
* Throws an exception if permit id doesn't exist or has already been released.
*
* @param permitId - permit id
* @return void
@ -199,14 +101,14 @@ public interface RPermitExpirableSemaphoreReactive extends RExpirableReactive {
Mono<Void> release(String permitId);
/**
* Returns the current number of available permits.
* Returns amount of available permits.
*
* @return number of available permits
* @return number of permits
*/
Mono<Integer> availablePermits();
/**
* Sets number of permits.
* Tries to set number of permits.
*
* @param permits - number of permits
* @return <code>true</code> if permits has been set successfully, otherwise <code>false</code>.
@ -216,7 +118,7 @@ public interface RPermitExpirableSemaphoreReactive extends RExpirableReactive {
/**
* Increases or decreases the number of available permits by defined value.
*
* @param permits - number of permits to add/remove
* @param permits amount of permits to add/remove
* @return void
*/
Mono<Void> addPermits(int permits);
@ -224,9 +126,9 @@ public interface RPermitExpirableSemaphoreReactive extends RExpirableReactive {
/**
* Overrides and updates lease time for defined permit id.
*
* @param permitId - permit id
* @param leaseTime - permit lease time, use -1 to make it permanent
* @param unit - the time unit of the {@code timeout} argument
* @param permitId permit id
* @param leaseTime permit lease time, use -1 to make it permanent
* @param unit the time unit
* @return <code>true</code> if permits has been updated successfully, otherwise <code>false</code>.
*/
Mono<Boolean> updateLeaseTime(String permitId, long leaseTime, TimeUnit unit);

@ -18,6 +18,7 @@ package org.redisson.api;
import java.util.concurrent.TimeUnit;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.reactivex.Single;
/**
@ -92,7 +93,7 @@ public interface RPermitExpirableSemaphoreRx extends RExpirableRx {
* @return permit id if a permit was acquired and {@code null}
* otherwise
*/
Single<String> tryAcquire();
Maybe<String> tryAcquire();
/**
* Acquires a permit from this semaphore, if one becomes available
@ -125,7 +126,7 @@ public interface RPermitExpirableSemaphoreRx extends RExpirableRx {
* @return permit id if a permit was acquired and {@code null}
* if the waiting time elapsed before a permit was acquired
*/
Single<String> tryAcquire(long waitTime, TimeUnit unit);
Maybe<String> tryAcquire(long waitTime, TimeUnit unit);
/**
* Acquires a permit with defined lease time from this semaphore,
@ -160,7 +161,7 @@ public interface RPermitExpirableSemaphoreRx extends RExpirableRx {
* @return permit id if a permit was acquired and {@code null}
* if the waiting time elapsed before a permit was acquired
*/
Single<String> tryAcquire(long waitTime, long leaseTime, TimeUnit unit);
Maybe<String> tryAcquire(long waitTime, long leaseTime, TimeUnit unit);
/**
* Releases a permit by its id, returning it to the semaphore.

@ -88,13 +88,14 @@ public interface RSemaphore extends RExpirable, RSemaphoreAsync {
boolean tryAcquire(int permits, long waitTime, TimeUnit unit) throws InterruptedException;
/**
* Releases a permit.
* Releases a permit. Increases the number of available permits.
*
*/
void release();
/**
* Releases defined amount of <code>permits</code>.
* Increases the number of available permits by <code>permits</code> amount.
*
* @param permits amount of permits
*/
@ -115,7 +116,7 @@ public interface RSemaphore extends RExpirable, RSemaphoreAsync {
int drainPermits();
/**
* Sets number of permits.
* Tries to set number of permits.
*
* @param permits - number of permits
* @return <code>true</code> if permits has been set successfully,

@ -80,7 +80,7 @@ public interface RSemaphoreAsync extends RExpirableAsync {
RFuture<Void> releaseAsync(int permits);
/**
* Sets number of permits.
* Tries to set number of permits.
*
* @param permits - number of permits
* @return <code>true</code> if permits has been set successfully, otherwise <code>false</code>.

@ -82,7 +82,7 @@ public interface RSemaphoreReactive extends RExpirableReactive {
Mono<Void> release(int permits);
/**
* Sets number of permits.
* Tries to set number of permits.
*
* @param permits - number of permits
* @return <code>true</code> if permits has been set successfully, otherwise <code>false</code>.

@ -83,7 +83,7 @@ public interface RSemaphoreRx extends RExpirableRx {
Completable release(int permits);
/**
* Sets number of permits.
* Tries to set number of permits.
*
* @param permits - number of permits
* @return <code>true</code> if permits has been set successfully, otherwise <code>false</code>.

Loading…
Cancel
Save