Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Jun 18, 2014
1 parent 202d681 commit 15daf1d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public interface BaseRedisAsyncConnection<K, V> extends Closeable {

RedisFuture<String> quit();

@Override
void close();

String digest(V script);

RedisFuture<String> discard();
Expand All @@ -48,6 +45,16 @@ public interface BaseRedisAsyncConnection<K, V> extends Closeable {

RedisFuture<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();

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public interface BaseRedisConnection<K, V> extends Closeable {

String quit();

@Override
void close();

String digest(V script);

String discard();
Expand All @@ -48,6 +45,16 @@ public interface BaseRedisConnection<K, V> 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();

}
18 changes: 18 additions & 0 deletions lettuce/src/main/java/com/lambdaworks/redis/Connections.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
import java.util.concurrent.ExecutionException;

/**
* Utility for checking a connection's state.
*
* @author <a href="mailto:[email protected]">Mark Paluch</a>
* @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");
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit 15daf1d

Please sign in to comment.