Javadocs added

pull/1639/head
Nikita 7 years ago
parent 6c17035c73
commit a0ab1cbdbf

@ -235,12 +235,12 @@ public class Redisson implements RedissonClient {
@Override
public RBuckets getBuckets() {
return new RedissonBuckets(this, connectionManager.getCommandExecutor());
return new RedissonBuckets(connectionManager.getCommandExecutor());
}
@Override
public RBuckets getBuckets(Codec codec) {
return new RedissonBuckets(this, codec, connectionManager.getCommandExecutor());
return new RedissonBuckets(codec, connectionManager.getCommandExecutor());
}
@Override

@ -18,13 +18,11 @@ package org.redisson;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.redisson.api.RBucket;
import org.redisson.api.RBuckets;
import org.redisson.api.RFuture;
import org.redisson.client.codec.Codec;
@ -45,30 +43,15 @@ public class RedissonBuckets implements RBuckets {
private final Codec codec;
private final CommandExecutor commandExecutor;
private final Redisson redisson;
public RedissonBuckets(Redisson redisson, CommandExecutor commandExecutor) {
this(redisson, commandExecutor.getConnectionManager().getCodec(), commandExecutor);
public RedissonBuckets(CommandExecutor commandExecutor) {
this(commandExecutor.getConnectionManager().getCodec(), commandExecutor);
}
public RedissonBuckets(Redisson redisson, Codec codec, CommandExecutor commandExecutor) {
public RedissonBuckets(Codec codec, CommandExecutor commandExecutor) {
super();
this.codec = codec;
this.commandExecutor = commandExecutor;
this.redisson = redisson;
}
@Override
public <V> List<RBucket<V>> find(String pattern) {
Iterable<String> keys = redisson.getKeys().getKeysByPattern(pattern);
List<RBucket<V>> buckets = new ArrayList<RBucket<V>>();
for (String key : keys) {
if(key == null) {
continue;
}
buckets.add(redisson.<V>getBucket(key, codec));
}
return buckets;
}
@Override

@ -16,7 +16,7 @@
package org.redisson.api;
/**
* Distributed alternative to the AtomicDouble
* Distributed implementation to the AtomicDouble
*
* @author Nikita Koksharov
*
@ -57,14 +57,14 @@ public interface RAtomicDouble extends RExpirable, RAtomicDoubleAsync {
double decrementAndGet();
/**
* Gets the current value.
* Returns current value.
*
* @return the current value
* @return current value
*/
double get();
/**
* Gets and deletes object
* Returns and deletes object
*
* @return the current value
*/

@ -16,37 +16,96 @@
package org.redisson.api;
/**
*
* Distributed implementation to the AtomicDouble
*
* @author Nikita Koksharov
*
*/
public interface RAtomicDoubleAsync extends RExpirableAsync {
/**
* Atomically sets the value to the given updated value
* only if the current value {@code ==} the expected value.
*
* @param expect the expected value
* @param update the new value
* @return true if successful; or false if the actual value
* was not equal to the expected value.
*/
RFuture<Boolean> compareAndSetAsync(double expect, double update);
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the updated value
*/
RFuture<Double> addAndGetAsync(double delta);
/**
* Atomically decrements the current value by one.
*
* @return the updated value
*/
RFuture<Double> decrementAndGetAsync();
/**
* Returns current value.
*
* @return current value
*/
RFuture<Double> getAsync();
/**
* Gets and deletes object
* Returns and deletes object
*
* @return the current value
*/
RFuture<Double> getAndDeleteAsync();
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the updated value
*/
RFuture<Double> getAndAddAsync(double delta);
/**
* Atomically sets the given value and returns the old value.
*
* @param newValue the new value
* @return the old value
*/
RFuture<Double> getAndSetAsync(double newValue);
/**
* Atomically increments the current value by one.
*
* @return the updated value
*/
RFuture<Double> incrementAndGetAsync();
/**
* Atomically increments the current value by one.
*
* @return the old value
*/
RFuture<Double> getAndIncrementAsync();
/**
* Atomically decrements by one the current value.
*
* @return the previous value
*/
RFuture<Double> getAndDecrementAsync();
/**
* Atomically sets the given value.
*
* @param newValue the new value
* @return void
*/
RFuture<Void> setAsync(double newValue);
}

@ -18,30 +18,96 @@ package org.redisson.api;
import org.reactivestreams.Publisher;
/**
*
* Distributed implementation to the AtomicDouble
*
* @author Nikita Koksharov
*
*/
public interface RAtomicDoubleReactive extends RExpirableReactive {
/**
* Atomically sets the value to the given updated value
* only if the current value {@code ==} the expected value.
*
* @param expect the expected value
* @param update the new value
* @return true if successful; or false if the actual value
* was not equal to the expected value.
*/
Publisher<Boolean> compareAndSet(double expect, double update);
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the updated value
*/
Publisher<Double> addAndGet(double delta);
/**
* Atomically decrements the current value by one.
*
* @return the updated value
*/
Publisher<Double> decrementAndGet();
/**
* Returns current value.
*
* @return current value
*/
Publisher<Double> get();
/**
* Returns and deletes object
*
* @return the current value
*/
Publisher<Double> getAndDelete();
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the updated value
*/
Publisher<Double> getAndAdd(double delta);
/**
* Atomically sets the given value and returns the old value.
*
* @param newValue the new value
* @return the old value
*/
Publisher<Double> getAndSet(double newValue);
/**
* Atomically increments the current value by one.
*
* @return the updated value
*/
Publisher<Double> incrementAndGet();
/**
* Atomically increments the current value by one.
*
* @return the old value
*/
Publisher<Double> getAndIncrement();
/**
* Atomically decrements by one the current value.
*
* @return the previous value
*/
Publisher<Double> getAndDecrement();
/**
* Atomically sets the given value.
*
* @param newValue the new value
* @return void
*/
Publisher<Void> set(double newValue);
}

@ -16,7 +16,7 @@
package org.redisson.api;
/**
* Distributed alternative to the {@link java.util.concurrent.atomic.AtomicLong}
* Distributed implementation of {@link java.util.concurrent.atomic.AtomicLong}
*
* @author Nikita Koksharov
*
@ -57,7 +57,7 @@ public interface RAtomicLong extends RExpirable, RAtomicLongAsync {
long decrementAndGet();
/**
* Gets the current value.
* Returns current value.
*
* @return the current value
*/

@ -16,37 +16,96 @@
package org.redisson.api;
/**
*
* Distributed async implementation of {@link java.util.concurrent.atomic.AtomicLong}
*
* @author Nikita Koksharov
*
*/
public interface RAtomicLongAsync extends RExpirableAsync {
/**
* Atomically sets the value to the given updated value
* only if the current value {@code ==} the expected value.
*
* @param expect the expected value
* @param update the new value
* @return true if successful; or false if the actual value
* was not equal to the expected value.
*/
RFuture<Boolean> compareAndSetAsync(long expect, long update);
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the updated value
*/
RFuture<Long> addAndGetAsync(long delta);
/**
* Atomically decrements the current value by one.
*
* @return the updated value
*/
RFuture<Long> decrementAndGetAsync();
/**
* Returns current value.
*
* @return the current value
*/
RFuture<Long> getAsync();
/**
* Gets and deletes object
* Returns and deletes object
*
* @return the current value
*/
RFuture<Long> getAndDeleteAsync();
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the old value before the add
*/
RFuture<Long> getAndAddAsync(long delta);
/**
* Atomically sets the given value and returns the old value.
*
* @param newValue the new value
* @return the old value
*/
RFuture<Long> getAndSetAsync(long newValue);
/**
* Atomically increments the current value by one.
*
* @return the updated value
*/
RFuture<Long> incrementAndGetAsync();
/**
* Atomically increments the current value by one.
*
* @return the old value
*/
RFuture<Long> getAndIncrementAsync();
/**
* Atomically decrements by one the current value.
*
* @return the previous value
*/
RFuture<Long> getAndDecrementAsync();
/**
* Atomically sets the given value.
*
* @param newValue the new value
* @return void
*/
RFuture<Void> setAsync(long newValue);
}

@ -18,30 +18,96 @@ package org.redisson.api;
import org.reactivestreams.Publisher;
/**
*
* Distributed reactive implementation of {@link java.util.concurrent.atomic.AtomicLong}
*
* @author Nikita Koksharov
*
*/
public interface RAtomicLongReactive extends RExpirableReactive {
/**
* Atomically sets the value to the given updated value
* only if the current value {@code ==} the expected value.
*
* @param expect the expected value
* @param update the new value
* @return true if successful; or false if the actual value
* was not equal to the expected value.
*/
Publisher<Boolean> compareAndSet(long expect, long update);
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the updated value
*/
Publisher<Long> addAndGet(long delta);
/**
* Atomically decrements the current value by one.
*
* @return the updated value
*/
Publisher<Long> decrementAndGet();
/**
* Returns current value.
*
* @return the current value
*/
Publisher<Long> get();
/**
* Returns and deletes object
*
* @return the current value
*/
Publisher<Long> getAndDelete();
/**
* Atomically adds the given value to the current value.
*
* @param delta the value to add
* @return the old value before the add
*/
Publisher<Long> getAndAdd(long delta);
/**
* Atomically sets the given value and returns the old value.
*
* @param newValue the new value
* @return the old value
*/
Publisher<Long> getAndSet(long newValue);
/**
* Atomically increments the current value by one.
*
* @return the updated value
*/
Publisher<Long> incrementAndGet();
/**
* Atomically increments the current value by one.
*
* @return the old value
*/
Publisher<Long> getAndIncrement();
/**
* Atomically decrements by one the current value.
*
* @return the previous value
*/
Publisher<Long> getAndDecrement();
/**
* Atomically sets the given value.
*
* @param newValue the new value
* @return void
*/
Publisher<Void> set(long newValue);
}

@ -21,7 +21,7 @@ import org.redisson.client.RedisException;
import org.redisson.client.codec.Codec;
/**
* Interface for using pipeline feature.
* Interface for using Redis pipeline feature.
* <p>
* All method invocations on objects got through this interface
* are batched to separate queue and could be executed later

@ -21,8 +21,8 @@ import org.reactivestreams.Publisher;
import org.redisson.client.codec.Codec;
/**
* Interface for using pipeline feature.
*
* Interface for using Redis pipeline feature.
* <p>
* All method invocations on objects
* from this interface are batched to separate queue and could be executed later
* with <code>execute()</code> method.

@ -19,7 +19,7 @@ import java.util.concurrent.BlockingDeque;
import java.util.concurrent.TimeUnit;
/**
* Async interface for {@link BlockingDeque} backed by Redis
* Distributed async implementation of {@link BlockingDeque}
*
* @author Nikita Koksharov
* @param <V> the type of elements held in this collection
@ -56,15 +56,57 @@ public interface RBlockingDequeAsync<V> extends RDequeAsync<V>, RBlockingQueueAs
*/
RFuture<V> pollLastFromAnyAsync(long timeout, TimeUnit unit, String ... queueNames);
/**
* Adds value to the head of queue.
*
* @param e value
* @return void
*/
RFuture<Void> putFirstAsync(V e);
/**
* Adds value to the tail of queue.
*
* @param e value
* @return void
*/
RFuture<Void> putLastAsync(V e);
/**
* Retrieves and removes value at the tail of queue. If necessary waits up to defined <code>timeout</code> for an element become available.
*
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the element at the head of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
RFuture<V> pollLastAsync(long timeout, TimeUnit unit);
/**
* Retrieves and removes value at the tail of queue. Waits for an element become available.
*
* @return the tail element of this queue
*/
RFuture<V> takeLastAsync();
/**
* Retrieves and removes value at the head of queue. If necessary waits up to defined <code>timeout</code> for an element become available.
*
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the element at the tail of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
RFuture<V> pollFirstAsync(long timeout, TimeUnit unit);
/**
* Retrieves and removes value at the head of queue. Waits for an element become available.
*
* @return the head element of this queue
*/
RFuture<V> takeFirstAsync();
}

@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit;
import org.reactivestreams.Publisher;
/**
* Reactive interface for {@link BlockingDeque} backed by Redis
* Distributed reactive implementation of {@link BlockingDeque}
*
* @author Nikita Koksharov
* @param <V> the type of elements held in this collection
@ -58,15 +58,58 @@ public interface RBlockingDequeReactive<V> extends RDequeReactive<V>, RBlockingQ
*/
Publisher<V> pollLastFromAny(long timeout, TimeUnit unit, String ... queueNames);
/**
* Adds value to the head of queue.
*
* @param e value
* @return void
*/
Publisher<Void> putFirst(V e);
/**
* Adds value to the tail of queue.
*
* @param e value
* @return void
*/
Publisher<Void> putLast(V e);
/**
* Retrieves and removes value at the tail of queue. If necessary waits up to defined <code>timeout</code> for an element become available.
*
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the element at the head of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
Publisher<V> pollLast(long timeout, TimeUnit unit);
/**
* Retrieves and removes value at the tail of queue. Waits for an element become available.
*
* @return the tail element of this queue
*/
Publisher<V> takeLast();
/**
* Retrieves and removes value at the head of queue. If necessary waits up to defined <code>timeout</code> for an element become available.
*
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the element at the tail of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
Publisher<V> pollFirst(long timeout, TimeUnit unit);
/**
* Retrieves and removes value at the head of queue. Waits for an element become available.
*
* @return the head element of this queue
*/
Publisher<V> takeFirst();
}

@ -19,7 +19,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
/**
* {@link BlockingQueue} backed by Redis
* Distributed implementation of {@link BlockingQueue}
*
* @author Nikita Koksharov
* @param <V> the type of elements held in this collection
@ -29,9 +29,9 @@ public interface RBlockingQueue<V> extends BlockingQueue<V>, RQueue<V>, RBlockin
/**
* Retrieves and removes first available head element of <b>any</b> queue,
* waiting up to the specified wait time if necessary for an element to become available
* in any of defined queues <b>including</b> queue own.
* in any of defined queues <b>including</b> queue itself.
*
* @param queueNames - names of queue
* @param queueNames - queue names. Queue name itself is always included
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
@ -42,8 +42,32 @@ public interface RBlockingQueue<V> extends BlockingQueue<V>, RQueue<V>, RBlockin
*/
V pollFromAny(long timeout, TimeUnit unit, String ... queueNames) throws InterruptedException;
/**
* Retrieves and removes last available tail element of <b>any</b> queue and adds it at the head of <code>queueName</code>,
* waiting up to the specified wait time if necessary for an element to become available
* in any of defined queues <b>including</b> queue itself.
*
* @param queueName - names of destination queue
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the tail of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
* @throws InterruptedException if interrupted while waiting
*/
V pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit) throws InterruptedException;
/**
* Retrieves and removes last available tail element of <b>any</b> queue and adds it at the head of <code>queueName</code>,
* waiting if necessary for an element to become available
* in any of defined queues <b>including</b> queue itself.
*
* @param queueName - names of destination queue
* @return the tail of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
* @throws InterruptedException if interrupted while waiting
*/
V takeLastAndOfferFirstTo(String queueName) throws InterruptedException;
}

@ -20,7 +20,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
/**
* {@link BlockingQueue} backed by Redis
* Distributed async implementation of {@link BlockingQueue}
*
* @author Nikita Koksharov
* @param <V> the type of elements held in this collection
@ -30,9 +30,9 @@ public interface RBlockingQueueAsync<V> extends RQueueAsync<V> {
/**
* Retrieves and removes first available head element of <b>any</b> queue in async mode,
* waiting up to the specified wait time if necessary for an element to become available
* in any of defined queues <b>including</b> queue own.
* in any of defined queues <b>including</b> queue itself.
*
* @param queueNames - names of queue
* @param queueNames - queue names. Queue name itself is always included
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
@ -92,8 +92,30 @@ public interface RBlockingQueueAsync<V> extends RQueueAsync<V> {
*/
RFuture<Integer> drainToAsync(Collection<? super V> c);
/**
* Retrieves and removes last available tail element of <b>any</b> queue and adds it at the head of <code>queueName</code>,
* waiting up to the specified wait time if necessary for an element to become available
* in any of defined queues <b>including</b> queue itself.
*
* @param queueName - names of destination queue
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the tail of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
RFuture<V> pollLastAndOfferFirstToAsync(String queueName, long timeout, TimeUnit unit);
/**
* Retrieves and removes last available tail element of <b>any</b> queue and adds it at the head of <code>queueName</code>,
* waiting if necessary for an element to become available
* in any of defined queues <b>including</b> queue itself.
*
* @param queueName - names of destination queue
* @return the tail of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
RFuture<V> takeLastAndOfferFirstToAsync(String queueName);
/**

@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
import org.reactivestreams.Publisher;
/**
* {@link BlockingQueue} backed by Redis
* Distributed reactive implementation of {@link BlockingQueue}
*
* @author Nikita Koksharov
* @param <V> the type of elements held in this collection
@ -44,16 +44,104 @@ public interface RBlockingQueueReactive<V> extends RQueueReactive<V> {
*/
Publisher<V> pollFromAny(long timeout, TimeUnit unit, String ... queueNames);
/**
* Removes at most the given number of available elements from
* this queue and adds them to the given collection in async mode. A failure
* encountered while attempting to add elements to
* collection {@code c} may result in elements being in neither,
* either or both collections when the associated exception is
* thrown. Attempts to drain a queue to itself result in
* {@code IllegalArgumentException}. Further, the behavior of
* this operation is undefined if the specified collection is
* modified while the operation is in progress.
*
* @param c the collection to transfer elements into
* @param maxElements the maximum number of elements to transfer
* @return the number of elements transferred
* @throws UnsupportedOperationException if addition of elements
* is not supported by the specified collection
* @throws ClassCastException if the class of an element of this queue
* prevents it from being added to the specified collection
* @throws NullPointerException if the specified collection is null
* @throws IllegalArgumentException if the specified collection is this
* queue, or some property of an element of this queue prevents
* it from being added to the specified collection
*/
Publisher<Integer> drainTo(Collection<? super V> c, int maxElements);
/**
* Removes all available elements from this queue and adds them
* to the given collection in async mode. This operation may be more
* efficient than repeatedly polling this queue. A failure
* encountered while attempting to add elements to
* collection {@code c} may result in elements being in neither,
* either or both collections when the associated exception is
* thrown. Attempts to drain a queue to itself result in
* {@code IllegalArgumentException}. Further, the behavior of
* this operation is undefined if the specified collection is
* modified while the operation is in progress.
*
* @param c the collection to transfer elements into
* @return the number of elements transferred
* @throws UnsupportedOperationException if addition of elements
* is not supported by the specified collection
* @throws ClassCastException if the class of an element of this queue
* prevents it from being added to the specified collection
* @throws NullPointerException if the specified collection is null
* @throws IllegalArgumentException if the specified collection is this
* queue, or some property of an element of this queue prevents
* it from being added to the specified collection
*/
Publisher<Integer> drainTo(Collection<? super V> c);
/**
* Retrieves and removes last available tail element of <b>any</b> queue and adds it at the head of <code>queueName</code>,
* waiting up to the specified wait time if necessary for an element to become available
* in any of defined queues <b>including</b> queue itself.
*
* @param queueName - names of destination queue
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the tail of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
Publisher<V> pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit);
/**
* Retrieves and removes the head of this queue in async mode, waiting up to the
* specified wait time if necessary for an element to become available.
*
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the head of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
*/
Publisher<V> poll(long timeout, TimeUnit unit);
/**
* Retrieves and removes the head of this queue in async mode, waiting if necessary
* until an element becomes available.
*
* @return the head of this queue
*/
Publisher<V> take();
/**
* Inserts the specified element into this queue in async mode, waiting if necessary
* for space to become available.
*
* @param e the element to add
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
* @return void
*/
Publisher<Integer> put(V e);
}

@ -16,7 +16,7 @@
package org.redisson.api;
/**
* Bloom filter based on Highway 128-bit hash.
* Distributed implementation of Bloom filter based on Highway 128-bit hash.
*
* @author Nikita Koksharov
*
@ -24,8 +24,22 @@ package org.redisson.api;
*/
public interface RBloomFilter<T> extends RExpirable {
/**
* Adds element
*
* @param object - element to add
* @return <code>true</code> if element has been added successfully
* <code>false</code> if element is already present
*/
boolean add(T object);
/**
* Check for element present
*
* @param object - element
* @return <code>true</code> if element is present
* <code>false</code> if element is not present
*/
boolean contains(T object);
/**
@ -33,15 +47,27 @@ public interface RBloomFilter<T> extends RExpirable {
* calculated from <code>expectedInsertions</code> and <code>falseProbability</code>
* Stores config to Redis server.
*
* @param expectedInsertions - expected amount of insertions
* @param expectedInsertions - expected amount of insertions per element
* @param falseProbability - expected false probability
* @return <code>true</code> if Bloom filter initialized
* <code>false</code> if Bloom filter already has been initialized
*/
boolean tryInit(long expectedInsertions, double falseProbability);
/**
* Returns expected amount of insertions per element.
* Calculated during bloom filter initialization.
*
* @return expected amount of insertions per element
*/
long getExpectedInsertions();
/**
* Returns false probability of element presence.
* Calculated during bloom filter initialization.
*
* @return false probability of element presence
*/
double getFalseProbability();
/**
@ -51,6 +77,12 @@ public interface RBloomFilter<T> extends RExpirable {
*/
long getSize();
/**
* Returns hash iterations amount used per element.
* Calculated during bloom filter initialization.
*
* @return hash iterations amount
*/
int getHashIterations();
/**

@ -18,7 +18,7 @@ package org.redisson.api;
import java.util.concurrent.BlockingQueue;
/**
* Bounded {@link BlockingQueue} backed by Redis
* Distributed implementation of bounded {@link BlockingQueue}
*
* @author Nikita Koksharov
* @param <V> the type of elements held in this collection

@ -19,7 +19,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
/**
* Bounded {@link BlockingQueue} backed by Redis
* Distributed async implementation of bounded {@link BlockingQueue}
*
* @author Nikita Koksharov
* @param <V> the type of elements held in this collection

@ -18,7 +18,7 @@ package org.redisson.api;
import java.util.concurrent.TimeUnit;
/**
* Any object holder. Max size of object is 512MB
* Object holder. Max size of object is 512MB
*
* @author Nikita Koksharov
*
@ -27,26 +27,80 @@ import java.util.concurrent.TimeUnit;
public interface RBucket<V> extends RExpirable, RBucketAsync<V> {
/**
* Returns size of object in bytes
* Returns size of object in bytes.
*
* @return object size
*/
long size();
/**
* Retrieves element stored in the holder.
*
* @return element
*/
V get();
/**
* Retrieves element in the holder and removes it.
*
* @return element
*/
V getAndDelete();
/**
* Tries to set element atomically into empty holder.
*
* @param value - value to set
* @return {@code true} if successful, or {@code false} if
* element was already set
*/
boolean trySet(V value);
/**
* Tries to set element atomically into empty holder with defined <code>timeToLive</code> interval.
*
* @param value - value to set
* @param timeToLive - time to live interval
* @param timeUnit - unit of time to live interval
* @return {@code true} if successful, or {@code false} if
* element was already set
*/
boolean trySet(V value, long timeToLive, TimeUnit timeUnit);
/**
* Atomically sets the value to the given updated value
* only if serialized state of the current value equals
* to serialized state of the expected value.
*
* @param expect the expected value
* @param update the new value
* @return {@code true} if successful; or {@code false} if the actual value
* was not equal to the expected value.
*/
boolean compareAndSet(V expect, V update);
/**
* Retrieves current element in the holder and replaces it with <code>newValue</code>.
*
* @param newValue - value to set
* @return previous value
*/
V getAndSet(V newValue);
/**
* Stores element into the holder.
*
* @param value - value to set
*/
void set(V value);
/**
* Stores element into the holder with defined <code>timeToLive</code> interval.
*
* @param value - value to set
* @param timeToLive - time to live interval
* @param timeUnit - unit of time to live interval
*/
void set(V value, long timeToLive, TimeUnit timeUnit);
}

@ -18,7 +18,7 @@ package org.redisson.api;
import java.util.concurrent.TimeUnit;
/**
* Async object functions
* Async implementation of object holder. Max size of object is 512MB
*
* @author Nikita Koksharov
*
@ -33,20 +33,76 @@ public interface RBucketAsync<V> extends RExpirableAsync {
*/
RFuture<Long> sizeAsync();
/**
* Retrieves element stored in the holder.
*
* @return element
*/
RFuture<V> getAsync();
/**
* Retrieves element in the holder and removes it.
*
* @return element
*/
RFuture<V> getAndDeleteAsync();
/**
* Tries to set element atomically into empty holder.
*
* @param value - value to set
* @return {@code true} if successful, or {@code false} if
* element was already set
*/
RFuture<Boolean> trySetAsync(V value);
/**
* Tries to set element atomically into empty holder with defined <code>timeToLive</code> interval.
*
* @param value - value to set
* @param timeToLive - time to live interval
* @param timeUnit - unit of time to live interval
* @return {@code true} if successful, or {@code false} if
* element was already set
*/
RFuture<Boolean> trySetAsync(V value, long timeToLive, TimeUnit timeUnit);
/**
* Atomically sets the value to the given updated value
* only if serialized state of the current value equals
* to serialized state of the expected value.
*
* @param expect the expected value
* @param update the new value
* @return {@code true} if successful; or {@code false} if the actual value
* was not equal to the expected value.
*/
RFuture<Boolean> compareAndSetAsync(V expect, V update);
/**
* Retrieves current element in the holder and replaces it with <code>newValue</code>.
*
* @param newValue - value to set
* @return previous value
*/
RFuture<V> getAndSetAsync(V newValue);
/**
* Stores element into the holder.
*
* @param value - value to set
* @return void
*/
RFuture<Void> setAsync(V value);
/**
* Stores element into the holder with defined <code>timeToLive</code> interval.
*
* @param value - value to set
* @param timeToLive - time to live interval
* @param timeUnit - unit of time to live interval
* @return void
*/
RFuture<Void> setAsync(V value, long timeToLive, TimeUnit timeUnit);
}

@ -21,7 +21,7 @@ import org.reactivestreams.Publisher;
/**
* Object holder. Max size of object is 512MB
* Reactive implementation of object holder. Max size of object is 512MB
*
* @author Nikita Koksharov
*
@ -36,20 +36,76 @@ public interface RBucketReactive<V> extends RExpirableReactive {
*/
Publisher<Long> size();
/**
* Tries to set element atomically into empty holder.
*
* @param value - value to set
* @return {@code true} if successful, or {@code false} if
* element was already set
*/
Publisher<Boolean> trySet(V value);
/**
* Tries to set element atomically into empty holder with defined <code>timeToLive</code> interval.
*
* @param value - value to set
* @param timeToLive - time to live interval
* @param timeUnit - unit of time to live interval
* @return {@code true} if successful, or {@code false} if
* element was already set
*/
Publisher<Boolean> trySet(V value, long timeToLive, TimeUnit timeUnit);
/**
* Atomically sets the value to the given updated value
* only if serialized state of the current value equals
* to serialized state of the expected value.
*
* @param expect the expected value
* @param update the new value
* @return {@code true} if successful; or {@code false} if the actual value
* was not equal to the expected value.
*/
Publisher<Boolean> compareAndSet(V expect, V update);
/**
* Retrieves current element in the holder and replaces it with <code>newValue</code>.
*
* @param newValue - value to set
* @return previous value
*/
Publisher<V> getAndSet(V newValue);
/**
* Retrieves element stored in the holder.
*
* @return element
*/
Publisher<V> get();
/**
* Retrieves element in the holder and removes it.
*
* @return element
*/
Publisher<V> getAndDelete();
/**
* Stores element into the holder.
*
* @param value - value to set
* @return void
*/
Publisher<Void> set(V value);
/**
* Stores element into the holder with defined <code>timeToLive</code> interval.
*
* @param value - value to set
* @param timeToLive - time to live interval
* @param timeUnit - unit of time to live interval
* @return void
*/
Publisher<Void> set(V value, long timeToLive, TimeUnit timeUnit);
}

@ -15,22 +15,16 @@
*/
package org.redisson.api;
import java.util.List;
import java.util.Map;
/**
* Operations over multiple Bucket objects.
*
* @author Nikita Koksharov
*
*/
public interface RBuckets extends RBucketsAsync {
/*
* Use RKeys.findKeysByPattern method instead
*/
@Deprecated
<V> List<RBucket<V>> find(String pattern);
/**
* Returns Redis object mapped by key. Result Map is not contains
* key-value entry for null values.

@ -18,6 +18,7 @@ package org.redisson.api;
import java.util.Map;
/**
* Operations over multiple Bucket objects.
*
* @author Nikita Koksharov
*
@ -48,6 +49,7 @@ public interface RBucketsAsync {
* Saves objects mapped by Redis key.
*
* @param buckets - map of buckets
* @return void
*/
RFuture<Void> setAsync(Map<String, ?> buckets);

@ -18,6 +18,7 @@ package org.redisson.api;
import java.util.Collection;
/**
* Common async interface for collection object
*
* @author Nikita Koksharov
*
@ -27,9 +28,7 @@ public interface RCollectionAsync<V> extends RExpirableAsync {
/**
* Retains only the elements in this collection that are contained in the
* specified collection (optional operation). In other words, removes from
* this collection all of its elements that are not contained in the
* specified collection.
* specified collection (optional operation).
*
* @param c collection containing elements to be retained in this collection
* @return <tt>true</tt> if this collection changed as a result of the call
@ -38,61 +37,65 @@ public interface RCollectionAsync<V> extends RExpirableAsync {
/**
* Removes all of this collection's elements that are also contained in the
* specified collection (optional operation). After this call returns,
* this collection will contain no elements in common with the specified
* collection.
* specified collection (optional operation).
*
* @param c collection containing elements to be removed from this collection
* @return <tt>true</tt> if this collection changed as a result of the
* @return <code>true</code> if this collection changed as a result of the
* call
*/
RFuture<Boolean> removeAllAsync(Collection<?> c);
/**
* Returns <tt>true</tt> if this collection contains the specified element.
* More formally, returns <tt>true</tt> if and only if this collection
* contains at least one element <tt>e</tt> such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>.
* Returns <code>true</code> if this collection contains encoded state of the specified element.
*
* @param o element whose presence in this collection is to be tested
* @return <tt>true</tt> if this collection contains the specified
* element
* @return <code>true</code> if this collection contains the specified
* element and <code>false</code> otherwise
*/
RFuture<Boolean> containsAsync(Object o);
/**
* Returns <tt>true</tt> if this collection contains all of the elements
* Returns <code>true</code> if this collection contains all of the elements
* in the specified collection.
*
* @param c collection to be checked for containment in this collection
* @return <tt>true</tt> if this collection contains all of the elements
* @return <code>true</code> if this collection contains all of the elements
* in the specified collection
*/
RFuture<Boolean> containsAllAsync(Collection<?> c);
/**
* Removes a single instance of the specified element from this
* collection, if it is present (optional operation). More formally,
* removes an element <tt>e</tt> such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>, if
* this collection contains one or more such elements. Returns
* <tt>true</tt> if this collection contained the specified element (or
* equivalently, if this collection changed as a result of the call).
* collection, if it is present (optional operation).
*
* @param o element to be removed from this collection, if present
* @return <tt>true</tt> if an element was removed as a result of this call
* @return <code>true</code> if an element was removed as a result of this call
*/
RFuture<Boolean> removeAsync(Object o);
/**
* Returns the number of elements in this collection.
* Returns number of elements in this collection.
*
* @return size of collection
*/
RFuture<Integer> sizeAsync();
/**
* Adds element into this collection.
*
* @param e - element to add
* @return <code>true</code> if an element was added
* and <code>false</code> if it is already present
*/
RFuture<Boolean> addAsync(V e);
/**
* Adds all elements contained in the specified collection
*
* @param c - collection of elements to add
* @return <code>true</code> if at least one element was added
* and <code>false</code> if all elements are already present
*/
RFuture<Boolean> addAllAsync(Collection<? extends V> c);
}

@ -20,6 +20,7 @@ import java.util.Collection;
import org.reactivestreams.Publisher;
/**
* Common reactive interface for collection object
*
* @author Nikita Koksharov
*
@ -27,24 +28,92 @@ import org.reactivestreams.Publisher;
*/
public interface RCollectionReactive<V> extends RExpirableReactive {
/**
* Returns iterator over collection elements
*
* @return iterator
*/
Publisher<V> iterator();
/**
* Retains only the elements in this collection that are contained in the
* specified collection (optional operation).
*
* @param c collection containing elements to be retained in this collection
* @return <tt>true</tt> if this collection changed as a result of the call
*/
Publisher<Boolean> retainAll(Collection<?> c);
/**
* Removes all of this collection's elements that are also contained in the
* specified collection (optional operation).
*
* @param c collection containing elements to be removed from this collection
* @return <code>true</code> if this collection changed as a result of the
* call
*/
Publisher<Boolean> removeAll(Collection<?> c);
/**
* Returns <code>true</code> if this collection contains encoded state of the specified element.
*
* @param o element whose presence in this collection is to be tested
* @return <code>true</code> if this collection contains the specified
* element and <code>false</code> otherwise
*/
Publisher<Boolean> contains(V o);
/**
* Returns <code>true</code> if this collection contains all of the elements
* in the specified collection.
*
* @param c collection to be checked for containment in this collection
* @return <code>true</code> if this collection contains all of the elements
* in the specified collection
*/
Publisher<Boolean> containsAll(Collection<?> c);
/**
* Removes a single instance of the specified element from this
* collection, if it is present (optional operation).
*
* @param o element to be removed from this collection, if present
* @return <code>true</code> if an element was removed as a result of this call
*/
Publisher<Boolean> remove(V o);
/**
* Returns number of elements in this collection.
*
* @return size of collection
*/
Publisher<Integer> size();
/**
* Adds element into this collection.
*
* @param e - element to add
* @return <code>true</code> if an element was added
* and <code>false</code> if it is already present
*/
Publisher<Integer> add(V e);
/**
* Adds all elements contained in the specified collection
*
* @param c - collection of elements to add
* @return <code>true</code> if at least one element was added
* and <code>false</code> if all elements are already present
*/
Publisher<Integer> addAll(Publisher<? extends V> c);
/**
* Adds all elements contained in the specified collection
*
* @param c - collection of elements to add
* @return <code>true</code> if at least one element was added
* and <code>false</code> if all elements are already present
*/
Publisher<Integer> addAll(Collection<? extends V> c);
}

@ -146,11 +146,14 @@ public interface RTransactionReactive {
/**
* Commits all changes made on this transaction.
*
* @return void
*/
Publisher<Void> commit();
/**
* Rollback all changes made on this transaction.
* @return void
*/
Publisher<Void> rollback();

@ -129,6 +129,16 @@ public class RedissonAtomicDoubleReactive extends RedissonExpirableReactive impl
}
});
}
@Override
public Publisher<Double> getAndDelete() {
return reactive(new Supplier<RFuture<Double>>() {
@Override
public RFuture<Double> get() {
return instance.getAndDeleteAsync();
}
});
}
public String toString() {
return instance.toString();

@ -88,6 +88,15 @@ public class RedissonAtomicLongReactive extends RedissonExpirableReactive implem
});
}
@Override
public Publisher<Long> getAndDelete() {
return reactive(new Supplier<RFuture<Long>>() {
@Override
public RFuture<Long> get() {
return instance.getAndDeleteAsync();
}
});
}
@Override
public Publisher<Long> getAndSet(final long newValue) {

Loading…
Cancel
Save