From 7838147444c7477e4bee191816300903ebd2802b Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Mon, 23 Dec 2019 10:03:28 +0300 Subject: [PATCH] javadocs updated --- .../api/RPermitExpirableSemaphore.java | 156 ++++------------- .../api/RPermitExpirableSemaphoreAsync.java | 156 ++++------------- .../RPermitExpirableSemaphoreReactive.java | 160 ++++-------------- .../api/RPermitExpirableSemaphoreRx.java | 7 +- .../java/org/redisson/api/RSemaphore.java | 5 +- .../org/redisson/api/RSemaphoreAsync.java | 2 +- .../org/redisson/api/RSemaphoreReactive.java | 2 +- .../java/org/redisson/api/RSemaphoreRx.java | 2 +- 8 files changed, 99 insertions(+), 391 deletions(-) diff --git a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphore.java b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphore.java index f2ad869c6..2a722beb9 100644 --- a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphore.java +++ b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphore.java @@ -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. * - *

Acquires 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: - *

- * * @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}. - * - *

Acquires a permit, if one is available and returns its id, - * reducing the number of available permits by one. + * Acquires a permit with defined leaseTime and return its id. + * Waits if necessary until a permit became available. * - *

If no permit is available then the current thread becomes - * disabled for thread scheduling purposes and lies dormant until - * one of two things happens: - *

- * - * @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. - * - *

Acquires 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 {@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}. - * - *

Acquires 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: - *

- * - *

If a permit is acquired then the permit id is returned. - * - *

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 waitTime 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}. - * - *

Acquires 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: - *

- * - *

If a permit is acquired then the permit id is returned. - * - *

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 leaseTime and return its id. + * Waits up to defined waitTime 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 null * 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. * - *

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 {@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 true if a permit has been released and false * otherwise */ boolean tryRelease(String permitId); /** - * Releases a permit by its id, returning it to the semaphore. - * - *

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 {@link #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 + * 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 true if permits has been set successfully, otherwise false. @@ -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 true if permits has been updated successfully, otherwise false. */ boolean updateLeaseTime(String permitId, long leaseTime, TimeUnit unit); diff --git a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreAsync.java b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreAsync.java index b9e3d84e9..00807b301 100644 --- a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreAsync.java +++ b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreAsync.java @@ -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}. - * - *

Acquires 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: - *

+ * Acquires a permit and returns its id. + * Waits if necessary until a permit became available. * * @return permit id */ RFuture acquireAsync(); /** - * Acquires a permit with defined lease time from this semaphore, - * blocking until one is available, - * or the thread is {@linkplain Thread#interrupt interrupted}. - * - *

Acquires 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: - *

+ * Acquires a permit with defined leaseTime 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 acquireAsync(long leaseTime, TimeUnit unit); /** - * Acquires a permit only if one is available at the - * time of invocation. - * - *

Acquires 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 {@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 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}. - * - *

Acquires 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: - *

    - *
  • Some other thread invokes the {@link #releaseAsync(String)} method for this - * semaphore and the current thread is next to be assigned a permit; or - *
  • Some other thread {@linkplain Thread#interrupt interrupts} - * the current thread; or - *
  • The specified waiting time elapses. - *
- * - *

If a permit is acquired then the permit id is returned. - * - *

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 waitTime 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 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}. - * - *

Acquires 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: - *

    - *
  • Some other thread invokes the {@link #releaseAsync(String)} method for this - * semaphore and the current thread is next to be assigned a permit; or - *
  • Some other thread {@linkplain Thread#interrupt interrupts} - * the current thread; or - *
  • The specified waiting time elapses. - *
- * - *

If a permit is acquired then the permit id is returned. - * - *

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 leaseTime and return its id. + * Waits up to defined waitTime 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 null * if the waiting time elapsed before a permit was acquired */ RFuture 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. * - *

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 {@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 true if a permit has been released and false * otherwise */ RFuture tryReleaseAsync(String permitId); /** - * Releases a permit by its id, returning it to the semaphore. - * - *

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 {@link #acquireAsync()}. - * 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 + * 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 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 availablePermitsAsync(); /** - * Sets number of permits. + * Tries to set number of permits. * * @param permits - number of permits * @return true if permits has been set successfully, otherwise false. @@ -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 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 true if permits has been updated successfully, otherwise false. */ RFuture updateLeaseTimeAsync(String permitId, long leaseTime, TimeUnit unit); diff --git a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreReactive.java b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreReactive.java index 1cd90bfa3..7def5c62e 100644 --- a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreReactive.java +++ b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreReactive.java @@ -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}. - * - *

Acquires 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: - *

    - *
  • Some other thread invokes the {@link #release(String)} method for this - * semaphore and the current thread is next to be assigned a permit; or - *
  • Some other thread {@linkplain Thread#interrupt interrupts} - * the current thread. - *
+ * Acquires a permit and returns its id. + * Waits if necessary until a permit became available. * * @return permit id */ Mono acquire(); /** - * Acquires a permit with defined lease time from this semaphore, - * blocking until one is available, - * or the thread is {@linkplain Thread#interrupt interrupted}. - * - *

Acquires 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: - *

    - *
  • Some other thread invokes the {@link #release} method for this - * semaphore and the current thread is next to be assigned a permit; or - *
  • Some other thread {@linkplain Thread#interrupt interrupts} - * the current thread. - *
+ * Acquires a permit with defined leaseTime 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 acquire(long leaseTime, TimeUnit unit); /** - * Acquires a permit only if one is available at the - * time of invocation. - * - *

Acquires 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 {@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 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 waitTime if necessary until a permit became available. * - *

Acquires 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: - *

    - *
  • Some other thread invokes the {@link #release(String)} method for this - * semaphore and the current thread is next to be assigned a permit; or - *
  • Some other thread {@linkplain Thread#interrupt interrupts} - * the current thread; or - *
  • The specified waiting time elapses. - *
- * - *

If a permit is acquired then the permit id is returned. - * - *

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 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}. - * - *

Acquires 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: - *

    - *
  • Some other thread invokes the {@link #release(String)} method for this - * semaphore and the current thread is next to be assigned a permit; or - *
  • Some other thread {@linkplain Thread#interrupt interrupts} - * the current thread; or - *
  • The specified waiting time elapses. - *
- * - *

If a permit is acquired then the permit id is returned. - * - *

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 leaseTime and return its id. + * Waits up to defined waitTime 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 null * if the waiting time elapsed before a permit was acquired */ Mono tryAcquire(long waitTime, long leaseTime, TimeUnit unit); /** - * Releases a permit by its id, returning it to the semaphore. - * - *

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. * - *

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 true if a permit has been released and false * otherwise */ Mono tryRelease(String permitId); /** - * Releases a permit by its id, returning it to the semaphore. - * - *

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 {@link #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 + * 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 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 availablePermits(); /** - * Sets number of permits. + * Tries to set number of permits. * * @param permits - number of permits * @return true if permits has been set successfully, otherwise false. @@ -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 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 true if permits has been updated successfully, otherwise false. */ Mono updateLeaseTime(String permitId, long leaseTime, TimeUnit unit); diff --git a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreRx.java b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreRx.java index 261955db6..10b64d87e 100644 --- a/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreRx.java +++ b/redisson/src/main/java/org/redisson/api/RPermitExpirableSemaphoreRx.java @@ -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 tryAcquire(); + Maybe 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 tryAcquire(long waitTime, TimeUnit unit); + Maybe 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 tryAcquire(long waitTime, long leaseTime, TimeUnit unit); + Maybe tryAcquire(long waitTime, long leaseTime, TimeUnit unit); /** * Releases a permit by its id, returning it to the semaphore. diff --git a/redisson/src/main/java/org/redisson/api/RSemaphore.java b/redisson/src/main/java/org/redisson/api/RSemaphore.java index 9eaf06ee4..1281d1271 100644 --- a/redisson/src/main/java/org/redisson/api/RSemaphore.java +++ b/redisson/src/main/java/org/redisson/api/RSemaphore.java @@ -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 permits. + * Increases the number of available permits by permits 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 true if permits has been set successfully, diff --git a/redisson/src/main/java/org/redisson/api/RSemaphoreAsync.java b/redisson/src/main/java/org/redisson/api/RSemaphoreAsync.java index f2ca8d482..60f432435 100644 --- a/redisson/src/main/java/org/redisson/api/RSemaphoreAsync.java +++ b/redisson/src/main/java/org/redisson/api/RSemaphoreAsync.java @@ -80,7 +80,7 @@ public interface RSemaphoreAsync extends RExpirableAsync { RFuture releaseAsync(int permits); /** - * Sets number of permits. + * Tries to set number of permits. * * @param permits - number of permits * @return true if permits has been set successfully, otherwise false. diff --git a/redisson/src/main/java/org/redisson/api/RSemaphoreReactive.java b/redisson/src/main/java/org/redisson/api/RSemaphoreReactive.java index 1aaf5552d..2b846613e 100644 --- a/redisson/src/main/java/org/redisson/api/RSemaphoreReactive.java +++ b/redisson/src/main/java/org/redisson/api/RSemaphoreReactive.java @@ -82,7 +82,7 @@ public interface RSemaphoreReactive extends RExpirableReactive { Mono release(int permits); /** - * Sets number of permits. + * Tries to set number of permits. * * @param permits - number of permits * @return true if permits has been set successfully, otherwise false. diff --git a/redisson/src/main/java/org/redisson/api/RSemaphoreRx.java b/redisson/src/main/java/org/redisson/api/RSemaphoreRx.java index 9f9cae7ae..820bbada7 100644 --- a/redisson/src/main/java/org/redisson/api/RSemaphoreRx.java +++ b/redisson/src/main/java/org/redisson/api/RSemaphoreRx.java @@ -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 true if permits has been set successfully, otherwise false.