javadocs updated

pull/2452/merge
Nikita Koksharov 5 years ago
parent 9c285ea309
commit 146297c2c1

@ -18,7 +18,7 @@ package org.redisson.api;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* Distributed implementation of {@link java.util.concurrent.CountDownLatch} * Redis based implementation of {@link java.util.concurrent.CountDownLatch}
* *
* It has an advantage over {@link java.util.concurrent.CountDownLatch} -- * It has an advantage over {@link java.util.concurrent.CountDownLatch} --
* count can be set via {@link #trySetCount} method. * count can be set via {@link #trySetCount} method.
@ -29,95 +29,33 @@ import java.util.concurrent.TimeUnit;
public interface RCountDownLatch extends RObject, RCountDownLatchAsync { public interface RCountDownLatch extends RObject, RCountDownLatchAsync {
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero.
* zero, unless the thread is {@linkplain Thread#interrupt interrupted}.
* *
* <p>If the current count is zero then this method returns immediately. * @throws InterruptedException if the current thread was interrupted
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until one of two things happen:
* <ul>
* <li>The count reaches zero due to invocations of the
* {@link #countDown} method; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread.
* </ul>
*
* <p>If the current thread:
* <ul>
* <li>has its interrupted status set on entry to this method; or
* <li>is {@linkplain Thread#interrupt interrupted} while waiting,
* </ul>
* then {@link InterruptedException} is thrown and the current thread's
* interrupted status is cleared.
*
* @throws InterruptedException if the current thread is interrupted
* while waiting
*/ */
void await() throws InterruptedException; void await() throws InterruptedException;
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero or up to defined <code>timeout</code>.
* zero, unless the thread is {@linkplain Thread#interrupt interrupted},
* or the specified waiting time elapses.
*
* <p>If the current count is zero then this method returns immediately
* with the value {@code true}.
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until one of three things happen:
* <ul>
* <li>The count reaches zero due to invocations of the
* {@link #countDown} method; or
* <li>Some other thread {@linkplain Thread#interrupt interrupts}
* the current thread; or
* <li>The specified waiting time elapses.
* </ul>
*
* <p>If the count reaches zero then the method returns with the
* value {@code true}.
*
* <p>If the current thread:
* <ul>
* <li>has its interrupted status set on entry to this method; or
* <li>is {@linkplain Thread#interrupt interrupted} while waiting,
* </ul>
* then {@link InterruptedException} is thrown and the current thread's
* interrupted status is cleared.
*
* <p>If the specified waiting time elapses then the value {@code false}
* is returned. If the time is less than or equal to zero, the method
* will not wait at all.
* *
* @param timeout the maximum time to wait * @param timeout the maximum time to wait
* @param unit the time unit of the {@code timeout} argument * @param unit the time unit
* @return {@code true} if the count reached zero and {@code false} * @return <code>true</code> if the count reached zero and <code>false</code>
* if the waiting time elapsed before the count reached zero * if timeout reached before the count reached zero
* @throws InterruptedException if the current thread is interrupted * @throws InterruptedException if the current thread was interrupted
* while waiting
*/ */
boolean await(long timeout, TimeUnit unit) throws InterruptedException; boolean await(long timeout, TimeUnit unit) throws InterruptedException;
/** /**
* Decrements the count of the latch, releasing all waiting threads if * Decrements the counter of the latch.
* the count reaches zero. * Notifies all waiting threads when count reaches zero.
*
* <p>If the current count is greater than zero then it is decremented.
* If the new count is zero then all waiting threads are re-enabled for
* thread scheduling purposes.
*
* <p>If the current count equals zero then nothing happens.
*/ */
void countDown(); void countDown();
/** /**
* Returns the current count. * Returns value of current count.
*
* <p>This method is typically used for debugging and testing purposes.
* *
* @return the current count * @return current count
*/ */
long getCount(); long getCount();

@ -18,7 +18,7 @@ package org.redisson.api;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* Async interface of {@link java.util.concurrent.CountDownLatch} * Async interface of Redis based {@link java.util.concurrent.CountDownLatch}
* *
* It has an advantage over {@link java.util.concurrent.CountDownLatch} -- * It has an advantage over {@link java.util.concurrent.CountDownLatch} --
* count can be set via {@link #trySetCountAsync} method. * count can be set via {@link #trySetCountAsync} method.
@ -29,63 +29,33 @@ import java.util.concurrent.TimeUnit;
public interface RCountDownLatchAsync extends RObjectAsync { public interface RCountDownLatchAsync extends RObjectAsync {
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero.
* zero.
* *
* <p>If the current count is zero then this method returns immediately. * @return void
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until the count reaches zero due to invocations of the
* {@link #countDownAsync} method.
* *
*/ */
RFuture<Void> awaitAsync(); RFuture<Void> awaitAsync();
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero or up to defined <code>timeout</code>.
* zero or the specified waiting time elapses.
*
* <p>If the current count is zero then this method returns immediately
* with the value {@code true}.
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until the count reaches zero due to invocations of the
* {@link #countDownAsync()} method or the specified waiting time elapses.
*
* <p>If the count reaches zero then the method returns with the
* value {@code true}.
*
* <p>If the specified waiting time elapses then the value {@code false}
* 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 * @param waitTime the maximum time to wait
* @param unit the time unit of the {@code timeout} argument * @param unit the time unit
* @return {@code true} if the count reached zero and {@code false} * @return <code>true</code> if the count reached zero and <code>false</code>
* if the waiting time elapsed before the count reached zero * if timeout reached before the count reached zero
*/ */
RFuture<Boolean> awaitAsync(long waitTime, TimeUnit unit); RFuture<Boolean> awaitAsync(long waitTime, TimeUnit unit);
/** /**
* Decrements the count of the latch, releasing all waiting threads if * Decrements the counter of the latch.
* the count reaches zero. * Notifies all waiting threads when count reaches zero.
*
* <p>If the current count is greater than zero then it is decremented.
* If the new count is zero then all waiting threads are re-enabled for
* thread scheduling purposes.
*
* <p>If the current count equals zero then nothing happens.
* *
* @return void * @return void
*/ */
RFuture<Void> countDownAsync(); RFuture<Void> countDownAsync();
/** /**
* Returns the current count. * Returns value of current count.
*
* <p>This method is typically used for debugging and testing purposes.
* *
* @return the current count * @return the current count
*/ */

@ -20,7 +20,7 @@ import reactor.core.publisher.Mono;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* Reactive interface of {@link java.util.concurrent.CountDownLatch} * Reactive interface of Redis based {@link java.util.concurrent.CountDownLatch}
* *
* It has an advantage over {@link java.util.concurrent.CountDownLatch} -- * It has an advantage over {@link java.util.concurrent.CountDownLatch} --
* count can be set via {@link #trySetCount} method. * count can be set via {@link #trySetCount} method.
@ -31,63 +31,33 @@ import java.util.concurrent.TimeUnit;
public interface RCountDownLatchReactive extends RObjectRx { public interface RCountDownLatchReactive extends RObjectRx {
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero.
* zero.
* *
* <p>If the current count is zero then this method returns immediately. * @return void
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until the count reaches zero due to invocations of the
* {@link #countDown} method.
* *
*/ */
Mono<Void> await(); Mono<Void> await();
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero or up to defined <code>timeout</code>.
* zero or the specified waiting time elapses.
*
* <p>If the current count is zero then this method returns immediately
* with the value {@code true}.
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until the count reaches zero due to invocations of the
* {@link #countDown()} method or the specified waiting time elapses.
*
* <p>If the count reaches zero then the method returns with the
* value {@code true}.
*
* <p>If the specified waiting time elapses then the value {@code false}
* 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 * @param waitTime the maximum time to wait
* @param unit the time unit of the {@code timeout} argument * @param unit the time unit
* @return {@code true} if the count reached zero and {@code false} * @return <code>true</code> if the count reached zero and <code>false</code>
* if the waiting time elapsed before the count reached zero * if timeout reached before the count reached zero
*/ */
Mono<Boolean> await(long waitTime, TimeUnit unit); Mono<Boolean> await(long waitTime, TimeUnit unit);
/** /**
* Decrements the count of the latch, releasing all waiting threads if * Decrements the counter of the latch.
* the count reaches zero. * Notifies all waiting threads when count reaches zero.
*
* <p>If the current count is greater than zero then it is decremented.
* If the new count is zero then all waiting threads are re-enabled for
* thread scheduling purposes.
*
* <p>If the current count equals zero then nothing happens.
* *
* @return void * @return void
*/ */
Mono<Void> countDown(); Mono<Void> countDown();
/** /**
* Returns the current count. * Returns value of current count.
*
* <p>This method is typically used for debugging and testing purposes.
* *
* @return the current count * @return the current count
*/ */

@ -21,7 +21,7 @@ import io.reactivex.Single;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* RxJava2 interface of {@link java.util.concurrent.CountDownLatch} * RxJava2 interface of Redis based {@link java.util.concurrent.CountDownLatch}
* *
* It has an advantage over {@link java.util.concurrent.CountDownLatch} -- * It has an advantage over {@link java.util.concurrent.CountDownLatch} --
* count can be set via {@link #trySetCount} method. * count can be set via {@link #trySetCount} method.
@ -32,63 +32,33 @@ import java.util.concurrent.TimeUnit;
public interface RCountDownLatchRx extends RObjectRx { public interface RCountDownLatchRx extends RObjectRx {
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero.
* zero.
* *
* <p>If the current count is zero then this method returns immediately. * @return void
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until the count reaches zero due to invocations of the
* {@link #countDown} method.
* *
*/ */
Completable await(); Completable await();
/** /**
* Causes the current thread to wait until the latch has counted down to * Waits until counter reach zero or up to defined <code>timeout</code>.
* zero or the specified waiting time elapses.
*
* <p>If the current count is zero then this method returns immediately
* with the value {@code true}.
*
* <p>If the current count is greater than zero then the current
* thread becomes disabled for thread scheduling purposes and lies
* dormant until the count reaches zero due to invocations of the
* {@link #countDown()} method or the specified waiting time elapses.
*
* <p>If the count reaches zero then the method returns with the
* value {@code true}.
*
* <p>If the specified waiting time elapses then the value {@code false}
* 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 * @param waitTime the maximum time to wait
* @param unit the time unit of the {@code timeout} argument * @param unit the time unit
* @return {@code true} if the count reached zero and {@code false} * @return <code>true</code> if the count reached zero and <code>false</code>
* if the waiting time elapsed before the count reached zero * if timeout reached before the count reached zero
*/ */
Single<Boolean> await(long waitTime, TimeUnit unit); Single<Boolean> await(long waitTime, TimeUnit unit);
/** /**
* Decrements the count of the latch, releasing all waiting threads if * Decrements the counter of the latch.
* the count reaches zero. * Notifies all waiting threads when count reaches zero.
*
* <p>If the current count is greater than zero then it is decremented.
* If the new count is zero then all waiting threads are re-enabled for
* thread scheduling purposes.
*
* <p>If the current count equals zero then nothing happens.
* *
* @return void * @return void
*/ */
Completable countDown(); Completable countDown();
/** /**
* Returns the current count. * Returns value of current count.
*
* <p>This method is typically used for debugging and testing purposes.
* *
* @return the current count * @return the current count
*/ */

Loading…
Cancel
Save