From f574b603155277a60bdd2410497f05268b0b6c58 Mon Sep 17 00:00:00 2001 From: Nikita Date: Wed, 12 Sep 2018 13:54:15 +0300 Subject: [PATCH] Javadocs added --- .../java/org/redisson/api/RBucketsAsync.java | 2 +- .../org/redisson/api/RCountDownLatch.java | 2 +- .../redisson/api/RCountDownLatchAsync.java | 2 +- .../java/org/redisson/api/RDelayedQueue.java | 1 + .../main/java/org/redisson/api/RDeque.java | 2 +- .../java/org/redisson/api/RDequeAsync.java | 92 ++++++++++++++++++- .../java/org/redisson/api/RDequeReactive.java | 92 ++++++++++++++++++- .../java/org/redisson/api/RDestroyable.java | 2 + .../redisson/api/RExecutorBatchFuture.java | 6 ++ .../org/redisson/api/RExecutorFuture.java | 1 + .../org/redisson/api/RExecutorService.java | 2 +- .../redisson/api/RExecutorServiceAsync.java | 2 +- .../java/org/redisson/api/RGeoReactive.java | 2 +- .../java/org/redisson/api/RHyperLogLog.java | 33 ++++++- .../org/redisson/api/RHyperLogLogAsync.java | 33 ++++++- .../redisson/api/RHyperLogLogReactive.java | 35 ++++++- .../src/main/java/org/redisson/api/RMap.java | 2 +- .../main/java/org/redisson/api/RMapAsync.java | 19 +++- .../redisson/api/RedissonNodeInitializer.java | 1 + .../redisson/api/RemoteInvocationOptions.java | 36 ++++++++ 20 files changed, 353 insertions(+), 14 deletions(-) diff --git a/redisson/src/main/java/org/redisson/api/RBucketsAsync.java b/redisson/src/main/java/org/redisson/api/RBucketsAsync.java index f16cef19d..e3431e36a 100644 --- a/redisson/src/main/java/org/redisson/api/RBucketsAsync.java +++ b/redisson/src/main/java/org/redisson/api/RBucketsAsync.java @@ -41,7 +41,7 @@ public interface RBucketsAsync { * don't set none of them. * * @param buckets - map of buckets - * @return true if object has been set overwise false + * @return true if object has been set otherwise false */ RFuture trySetAsync(Map buckets); diff --git a/redisson/src/main/java/org/redisson/api/RCountDownLatch.java b/redisson/src/main/java/org/redisson/api/RCountDownLatch.java index 8f5d71845..b76b5bb1d 100644 --- a/redisson/src/main/java/org/redisson/api/RCountDownLatch.java +++ b/redisson/src/main/java/org/redisson/api/RCountDownLatch.java @@ -18,7 +18,7 @@ package org.redisson.api; import java.util.concurrent.TimeUnit; /** - * Distributed alternative to the {@link java.util.concurrent.CountDownLatch} + * Distributed implementation of {@link java.util.concurrent.CountDownLatch} * * It has an advantage over {@link java.util.concurrent.CountDownLatch} -- * count can be set via {@link #trySetCount} method. diff --git a/redisson/src/main/java/org/redisson/api/RCountDownLatchAsync.java b/redisson/src/main/java/org/redisson/api/RCountDownLatchAsync.java index 681fa1f6c..2619eabbf 100644 --- a/redisson/src/main/java/org/redisson/api/RCountDownLatchAsync.java +++ b/redisson/src/main/java/org/redisson/api/RCountDownLatchAsync.java @@ -16,7 +16,7 @@ package org.redisson.api; /** - * Distributed alternative to the {@link java.util.concurrent.CountDownLatch} + * Distributed async implementation of {@link java.util.concurrent.CountDownLatch} * * It has an advantage over {@link java.util.concurrent.CountDownLatch} -- * count can be set via {@link #trySetCountAsync} method. diff --git a/redisson/src/main/java/org/redisson/api/RDelayedQueue.java b/redisson/src/main/java/org/redisson/api/RDelayedQueue.java index 032fead30..753945642 100644 --- a/redisson/src/main/java/org/redisson/api/RDelayedQueue.java +++ b/redisson/src/main/java/org/redisson/api/RDelayedQueue.java @@ -18,6 +18,7 @@ package org.redisson.api; import java.util.concurrent.TimeUnit; /** + * Distributed implementation of delayed queue. * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RDeque.java b/redisson/src/main/java/org/redisson/api/RDeque.java index a535c89dd..7b8e7ea08 100644 --- a/redisson/src/main/java/org/redisson/api/RDeque.java +++ b/redisson/src/main/java/org/redisson/api/RDeque.java @@ -18,7 +18,7 @@ package org.redisson.api; import java.util.Deque; /** - * {@link java.util.Deque} backed by Redis + * Distributed implementation of {@link java.util.Deque} * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RDequeAsync.java b/redisson/src/main/java/org/redisson/api/RDequeAsync.java index 0a1343dee..899ac66aa 100644 --- a/redisson/src/main/java/org/redisson/api/RDequeAsync.java +++ b/redisson/src/main/java/org/redisson/api/RDequeAsync.java @@ -16,7 +16,7 @@ package org.redisson.api; /** - * {@link java.util.Deque} backed by Redis + * Distributed async implementation of {@link java.util.Deque} * * @author Nikita Koksharov * @@ -24,34 +24,124 @@ package org.redisson.api; */ public interface RDequeAsync extends RQueueAsync { + /** + * Removes last occurrence of element o + * + * @param o - element + * @return true if object has been removed otherwise false + */ RFuture removeLastOccurrenceAsync(Object o); + /** + * Retrieves and removes the last element of deque. + * Returns null if there are no elements in deque. + * + * @return element + */ RFuture removeLastAsync(); + /** + * Retrieves and removes the first element of deque. + * Returns null if there are no elements in deque. + * + * @return element + */ RFuture removeFirstAsync(); + /** + * Removes first occurrence of element o + * + * @param o - element to remove + * @return true if object has been removed otherwise false + */ RFuture removeFirstOccurrenceAsync(Object o); + /** + * Adds element at the head of this deque. + * + * @param e - element to add + * @return void + */ RFuture pushAsync(V e); + /** + * Retrieves and removes element at the head of this deque. + * Returns null if there are no elements in deque. + * + * @return element + */ RFuture popAsync(); + /** + * Retrieves and removes element at the tail of this deque. + * Returns null if there are no elements in deque. + * + * @return element + */ RFuture pollLastAsync(); + /** + * Retrieves and removes element at the head of this deque. + * Returns null if there are no elements in deque. + * + * @return element + */ RFuture pollFirstAsync(); + /** + * Returns element at the tail of this deque + * or null if there are no elements in deque. + * + * @return element + */ RFuture peekLastAsync(); + /** + * Returns element at the head of this deque + * or null if there are no elements in deque. + * + * @return element + */ RFuture peekFirstAsync(); + /** + * Adds element at the tail of this deque. + * + * @param e - element to add + * @return true if element was added to this deque otherwise false + */ RFuture offerLastAsync(V e); + /** + * Returns element at the tail of this deque + * or null if there are no elements in deque. + * + * @return element + */ RFuture getLastAsync(); + /** + * Adds element at the tail of this deque. + * + * @param e - element to add + * @return void + */ RFuture addLastAsync(V e); + /** + * Adds element at the head of this deque. + * + * @param e - element to add + * @return void + */ RFuture addFirstAsync(V e); + /** + * Adds element at the head of this deque. + * + * @param e - element to add + * @return true if element was added to this deque otherwise false + */ RFuture offerFirstAsync(V e); } diff --git a/redisson/src/main/java/org/redisson/api/RDequeReactive.java b/redisson/src/main/java/org/redisson/api/RDequeReactive.java index 3a8a21d66..c388b12fa 100644 --- a/redisson/src/main/java/org/redisson/api/RDequeReactive.java +++ b/redisson/src/main/java/org/redisson/api/RDequeReactive.java @@ -18,7 +18,7 @@ package org.redisson.api; import org.reactivestreams.Publisher; /** - * {@link java.util.Deque} backed by Redis + * Distributed reactive implementation of {@link java.util.Deque} * * @author Nikita Koksharov * @@ -28,34 +28,124 @@ public interface RDequeReactive extends RQueueReactive { Publisher descendingIterator(); + /** + * Removes last occurrence of element o + * + * @param o - element + * @return true if object has been removed otherwise false + */ Publisher removeLastOccurrence(Object o); + /** + * Retrieves and removes the last element of deque. + * Returns null if there are no elements in deque. + * + * @return element + */ Publisher removeLast(); + /** + * Retrieves and removes the first element of deque. + * Returns null if there are no elements in deque. + * + * @return element + */ Publisher removeFirst(); + /** + * Removes first occurrence of element o + * + * @param o - element to remove + * @return true if object has been removed otherwise false + */ Publisher removeFirstOccurrence(Object o); + /** + * Adds element at the head of this deque. + * + * @param e - element to add + * @return void + */ Publisher push(V e); + /** + * Retrieves and removes element at the head of this deque. + * Returns null if there are no elements in deque. + * + * @return element + */ Publisher pop(); + /** + * Retrieves and removes element at the tail of this deque. + * Returns null if there are no elements in deque. + * + * @return element + */ Publisher pollLast(); + /** + * Retrieves and removes element at the head of this deque. + * Returns null if there are no elements in deque. + * + * @return element + */ Publisher pollFirst(); + /** + * Returns element at the tail of this deque + * or null if there are no elements in deque. + * + * @return element + */ Publisher peekLast(); + /** + * Returns element at the head of this deque + * or null if there are no elements in deque. + * + * @return element + */ Publisher peekFirst(); + /** + * Adds element at the tail of this deque. + * + * @param e - element to add + * @return true if element was added to this deque otherwise false + */ Publisher offerLast(V e); + /** + * Returns element at the tail of this deque + * or null if there are no elements in deque. + * + * @return element + */ Publisher getLast(); + /** + * Adds element at the tail of this deque. + * + * @param e - element to add + * @return void + */ Publisher addLast(V e); + /** + * Adds element at the head of this deque. + * + * @param e - element to add + * @return void + */ Publisher addFirst(V e); + /** + * Adds element at the head of this deque. + * + * @param e - element to add + * @return true if element was added to this deque otherwise false + */ Publisher offerFirst(V e); } diff --git a/redisson/src/main/java/org/redisson/api/RDestroyable.java b/redisson/src/main/java/org/redisson/api/RDestroyable.java index 7327b2f7a..8f9355217 100644 --- a/redisson/src/main/java/org/redisson/api/RDestroyable.java +++ b/redisson/src/main/java/org/redisson/api/RDestroyable.java @@ -16,6 +16,8 @@ package org.redisson.api; /** + * All objects that implement this interface + * should be destroyed via {@link #destroy()} method. * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RExecutorBatchFuture.java b/redisson/src/main/java/org/redisson/api/RExecutorBatchFuture.java index 70de5f0ca..9d8553d23 100644 --- a/redisson/src/main/java/org/redisson/api/RExecutorBatchFuture.java +++ b/redisson/src/main/java/org/redisson/api/RExecutorBatchFuture.java @@ -18,12 +18,18 @@ package org.redisson.api; import java.util.List; /** + * Future object for submitted tasks in a batch * * @author Nikita Koksharov * */ public interface RExecutorBatchFuture extends RFuture { + /** + * Returns list of Future objects. Each Future object represents submitted task. + * + * @return list + */ List> getTaskFutures(); } diff --git a/redisson/src/main/java/org/redisson/api/RExecutorFuture.java b/redisson/src/main/java/org/redisson/api/RExecutorFuture.java index 01c3ae038..b9f69f085 100644 --- a/redisson/src/main/java/org/redisson/api/RExecutorFuture.java +++ b/redisson/src/main/java/org/redisson/api/RExecutorFuture.java @@ -16,6 +16,7 @@ package org.redisson.api; /** + * Future object for submitted task * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RExecutorService.java b/redisson/src/main/java/org/redisson/api/RExecutorService.java index 7a869213d..6a7a2081f 100644 --- a/redisson/src/main/java/org/redisson/api/RExecutorService.java +++ b/redisson/src/main/java/org/redisson/api/RExecutorService.java @@ -19,7 +19,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; /** - * Redis based implementation of {@link java.util.concurrent.ExecutorService} + * Distributed implementation of {@link java.util.concurrent.ExecutorService} * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RExecutorServiceAsync.java b/redisson/src/main/java/org/redisson/api/RExecutorServiceAsync.java index 6749f5342..440f96b17 100644 --- a/redisson/src/main/java/org/redisson/api/RExecutorServiceAsync.java +++ b/redisson/src/main/java/org/redisson/api/RExecutorServiceAsync.java @@ -18,7 +18,7 @@ package org.redisson.api; import java.util.concurrent.Callable; /** - * Redis based implementation of {@link java.util.concurrent.ExecutorService} + * Distributed async implementation of {@link java.util.concurrent.ExecutorService} * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RGeoReactive.java b/redisson/src/main/java/org/redisson/api/RGeoReactive.java index 01f6a6aaa..37337c29f 100644 --- a/redisson/src/main/java/org/redisson/api/RGeoReactive.java +++ b/redisson/src/main/java/org/redisson/api/RGeoReactive.java @@ -21,7 +21,7 @@ import java.util.Map; import org.reactivestreams.Publisher; /** - * Geospatial items holder. + * Geospatial items holder. Reactive interface. * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RHyperLogLog.java b/redisson/src/main/java/org/redisson/api/RHyperLogLog.java index f5ce135ea..44fa3001c 100644 --- a/redisson/src/main/java/org/redisson/api/RHyperLogLog.java +++ b/redisson/src/main/java/org/redisson/api/RHyperLogLog.java @@ -22,18 +22,49 @@ import java.util.Collection; * * @author Nikita Koksharov * - * @param value + * @param type of stored values */ public interface RHyperLogLog extends RExpirable, RHyperLogLogAsync { + /** + * Adds element into this structure. + * + * @param obj - element to add + * @return true if object has been added + * or false if it was already added + */ boolean add(V obj); + /** + * Adds all elements contained in objects collection into this structure + * + * @param objects - elements to add + * @return true if at least one object has been added + * or false if all were already added + */ boolean addAll(Collection objects); + /** + * Returns approximated number of unique elements added into this structure. + * + * @return approximated number of unique elements added into this structure + */ long count(); + /** + * Returns approximated number of unique elements + * added into this instances and other instances defined through otherLogNames. + * + * @param otherLogNames - name of instances + * @return + */ long countWith(String ... otherLogNames); + /** + * Merges multiple instances into this instance. + * + * @param otherLogNames - name of instances + */ void mergeWith(String ... otherLogNames); } diff --git a/redisson/src/main/java/org/redisson/api/RHyperLogLogAsync.java b/redisson/src/main/java/org/redisson/api/RHyperLogLogAsync.java index b81600543..f5bb02fbb 100644 --- a/redisson/src/main/java/org/redisson/api/RHyperLogLogAsync.java +++ b/redisson/src/main/java/org/redisson/api/RHyperLogLogAsync.java @@ -23,18 +23,49 @@ import java.util.Collection; * * @author Nikita Koksharov * - * @param value + * @param type of stored values */ public interface RHyperLogLogAsync extends RExpirableAsync { + /** + * Adds element into this structure. + * + * @param obj - element to add + * @return true if object has been added + * or false if it was already added + */ RFuture addAsync(V obj); + /** + * Adds all elements contained in objects collection into this structure + * + * @param objects - elements to add + * @return true if at least one object has been added + * or false if all were already added + */ RFuture addAllAsync(Collection objects); + /** + * Returns approximated number of unique elements added into this structure. + * + * @return approximated number of unique elements added into this structure + */ RFuture countAsync(); + /** + * Returns approximated number of unique elements + * added into this instances and other instances defined through otherLogNames. + * + * @param otherLogNames - name of instances + * @return + */ RFuture countWithAsync(String ... otherLogNames); + /** + * Merges multiple instances into this instance. + * + * @param otherLogNames - name of instances + */ RFuture mergeWithAsync(String ... otherLogNames); } diff --git a/redisson/src/main/java/org/redisson/api/RHyperLogLogReactive.java b/redisson/src/main/java/org/redisson/api/RHyperLogLogReactive.java index 2e04082ea..1a6c78a61 100644 --- a/redisson/src/main/java/org/redisson/api/RHyperLogLogReactive.java +++ b/redisson/src/main/java/org/redisson/api/RHyperLogLogReactive.java @@ -20,21 +20,54 @@ import java.util.Collection; import org.reactivestreams.Publisher; /** + * Probabilistic data structure that lets you maintain counts of millions of items with extreme space efficiency. + * Reactive interface. * * @author Nikita Koksharov * - * @param + * @param type of stored values */ public interface RHyperLogLogReactive extends RExpirableReactive { + /** + * Adds element into this structure. + * + * @param obj - element to add + * @return true if object has been added + * or false if it was already added + */ Publisher add(V obj); + /** + * Adds all elements contained in objects collection into this structure + * + * @param objects - elements to add + * @return true if at least one object has been added + * or false if all were already added + */ Publisher addAll(Collection objects); + /** + * Returns approximated number of unique elements added into this structure. + * + * @return approximated number of unique elements added into this structure + */ Publisher count(); + /** + * Returns approximated number of unique elements + * added into this instances and other instances defined through otherLogNames. + * + * @param otherLogNames - name of instances + * @return + */ Publisher countWith(String ... otherLogNames); + /** + * Merges multiple instances into this instance. + * + * @param otherLogNames - name of instances + */ Publisher mergeWith(String ... otherLogNames); } diff --git a/redisson/src/main/java/org/redisson/api/RMap.java b/redisson/src/main/java/org/redisson/api/RMap.java index b0fdc3588..1fd0647d9 100644 --- a/redisson/src/main/java/org/redisson/api/RMap.java +++ b/redisson/src/main/java/org/redisson/api/RMap.java @@ -25,7 +25,7 @@ import org.redisson.api.map.MapWriter; import org.redisson.api.mapreduce.RMapReduce; /** - * Distributed and concurrent implementation of {@link java.util.concurrent.ConcurrentMap} + * Distributed implementation of {@link java.util.concurrent.ConcurrentMap} * and {@link java.util.Map} * * This map doesn't allow to store null as key or value. diff --git a/redisson/src/main/java/org/redisson/api/RMapAsync.java b/redisson/src/main/java/org/redisson/api/RMapAsync.java index 72b35c4a2..82a325543 100644 --- a/redisson/src/main/java/org/redisson/api/RMapAsync.java +++ b/redisson/src/main/java/org/redisson/api/RMapAsync.java @@ -25,7 +25,9 @@ import org.redisson.api.map.MapWriter; import java.util.Set; /** - * Async map functions + * Distributed async implementation of {@link Map}. + * + * This map doesn't allow to store null as key or value. * * @author Nikita Koksharov * @@ -86,12 +88,27 @@ public interface RMapAsync extends RExpirableAsync { */ RFuture putAllAsync(Map map); + /** + * Atomically adds the given delta to the current value + * by mapped key. + * + * Works only for numeric values! + * + * @param key - map key + * @param value - delta the value to add + * @return the updated value + */ RFuture addAndGetAsync(K key, Number value); RFuture containsValueAsync(Object value); RFuture containsKeyAsync(Object key); + /** + * Returns size of this map + * + * @return size + */ RFuture sizeAsync(); /** diff --git a/redisson/src/main/java/org/redisson/api/RedissonNodeInitializer.java b/redisson/src/main/java/org/redisson/api/RedissonNodeInitializer.java index 99efcdabd..031bec5bd 100644 --- a/redisson/src/main/java/org/redisson/api/RedissonNodeInitializer.java +++ b/redisson/src/main/java/org/redisson/api/RedissonNodeInitializer.java @@ -18,6 +18,7 @@ package org.redisson.api; import org.redisson.RedissonNode; /** + * Node initializer callback interface. * * @author Nikita Koksharov * diff --git a/redisson/src/main/java/org/redisson/api/RemoteInvocationOptions.java b/redisson/src/main/java/org/redisson/api/RemoteInvocationOptions.java index 129dc6d59..5c850e31d 100644 --- a/redisson/src/main/java/org/redisson/api/RemoteInvocationOptions.java +++ b/redisson/src/main/java/org/redisson/api/RemoteInvocationOptions.java @@ -105,31 +105,67 @@ public class RemoteInvocationOptions implements Serializable { return executionTimeoutInMillis != null; } + /** + * Defines ACK timeout + * + * @param ackTimeoutInMillis - timeout in milliseconds + * @return RemoteInvocationOptions object + */ public RemoteInvocationOptions expectAckWithin(long ackTimeoutInMillis) { this.ackTimeoutInMillis = ackTimeoutInMillis; return this; } + /** + * Defines ACK timeout + * + * @param ackTimeout - timeout + * @param timeUnit - timeout unit + * @return RemoteInvocationOptions object + */ public RemoteInvocationOptions expectAckWithin(long ackTimeout, TimeUnit timeUnit) { this.ackTimeoutInMillis = timeUnit.toMillis(ackTimeout); return this; } + /** + * Specifies to not wait for ACK reply + * + * @return RemoteInvocationOptions object + */ public RemoteInvocationOptions noAck() { ackTimeoutInMillis = null; return this; } + /** + * Defines execution timeout + * + * @param executionTimeoutInMillis - timeout in milliseconds + * @return RemoteInvocationOptions object + */ public RemoteInvocationOptions expectResultWithin(long executionTimeoutInMillis) { this.executionTimeoutInMillis = executionTimeoutInMillis; return this; } + /** + * Defines execution timeout + * + * @param executionTimeout - timeout + * @param timeUnit - timeout unit + * @return RemoteInvocationOptions object + */ public RemoteInvocationOptions expectResultWithin(long executionTimeout, TimeUnit timeUnit) { this.executionTimeoutInMillis = timeUnit.toMillis(executionTimeout); return this; } + /** + * Specifies to not wait for result + * + * @return RemoteInvocationOptions object + */ public RemoteInvocationOptions noResult() { executionTimeoutInMillis = null; return this;