From 15daf1dc611f392aa429d44e79230e0f0e5bb13d Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 18 Jun 2014 13:42:05 +0200 Subject: [PATCH] Documentation --- .../redis/BaseRedisAsyncConnection.java | 13 ++++++++++--- .../lambdaworks/redis/BaseRedisConnection.java | 13 ++++++++++--- .../com/lambdaworks/redis/Connections.java | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisAsyncConnection.java b/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisAsyncConnection.java index 1f9705591e..34b2a11b45 100644 --- a/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisAsyncConnection.java +++ b/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisAsyncConnection.java @@ -31,9 +31,6 @@ public interface BaseRedisAsyncConnection extends Closeable { RedisFuture quit(); - @Override - void close(); - String digest(V script); RedisFuture discard(); @@ -48,6 +45,16 @@ public interface BaseRedisAsyncConnection extends Closeable { RedisFuture waitForReplication(int replicas, long timeout); + /** + * Close the connection. The connection will become not usable anymore as soon as this method was called. + */ + @Override + void close(); + + /** + * + * @return true if the connection is open (connected and not closed). + */ boolean isOpen(); } diff --git a/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisConnection.java b/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisConnection.java index 0eff4c06e0..fec6d5391c 100644 --- a/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisConnection.java +++ b/lettuce/src/main/java/com/lambdaworks/redis/BaseRedisConnection.java @@ -31,9 +31,6 @@ public interface BaseRedisConnection extends Closeable { String quit(); - @Override - void close(); - String digest(V script); String discard(); @@ -48,6 +45,16 @@ public interface BaseRedisConnection extends Closeable { Long waitForReplication(int replicas, long timeout); + /** + * Close the connection. The connection will become not usable anymore as soon as this method was called. + */ + @Override + void close(); + + /** + * + * @return true if the connection is open (connected and not closed). + */ boolean isOpen(); } diff --git a/lettuce/src/main/java/com/lambdaworks/redis/Connections.java b/lettuce/src/main/java/com/lambdaworks/redis/Connections.java index 9c418bab01..41e4ebf17c 100644 --- a/lettuce/src/main/java/com/lambdaworks/redis/Connections.java +++ b/lettuce/src/main/java/com/lambdaworks/redis/Connections.java @@ -5,10 +5,18 @@ import java.util.concurrent.ExecutionException; /** + * Utility for checking a connection's state. + * * @author Mark Paluch * @since 14.05.14 22:05 */ public class Connections { + + /** + * + * @param connection + * @return true if the connection is valid (ping works). + */ public final static boolean isValid(Object connection) { checkNotNull(connection, "connection must not be null"); @@ -39,6 +47,11 @@ public final static boolean isValid(Object connection) { throw new IllegalArgumentException("Connection class " + connection.getClass() + " not supported"); } + /** + * + * @param connection + * @return true if the connection is open. + */ public final static boolean isOpen(Object connection) { checkNotNull(connection, "connection must not be null"); @@ -55,6 +68,11 @@ public final static boolean isOpen(Object connection) { throw new IllegalArgumentException("Connection class " + connection.getClass() + " not supported"); } + /** + * Closes a connection. + * + * @param connection + */ public static void close(Object connection) { checkNotNull(connection, "connection must not be null");