diff --git a/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterAsyncConnection.java b/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterAsyncConnection.java index d0bd7d986f..f1dc5f9ad1 100644 --- a/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterAsyncConnection.java +++ b/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterAsyncConnection.java @@ -1,11 +1,8 @@ package com.lambdaworks.redis.cluster; -import java.util.function.Predicate; - import com.lambdaworks.redis.RedisClusterAsyncConnection; -import com.lambdaworks.redis.cluster.api.NodeSelection; +import com.lambdaworks.redis.RedisException; import com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection; -import com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode; /** * Advanced asynchronous and thread-safe cluster API. @@ -20,21 +17,30 @@ public interface RedisAdvancedClusterAsyncConnection extends RedisClusterA /** * Retrieve a connection to the specified cluster node using the nodeId. Host and port are looked up in the node list. * + * Do not close the connections. Otherwise, unpredictable behavior will occur. The nodeId must be part of the cluster and is + * validated against the current topology view in {@link com.lambdaworks.redis.cluster.models.partitions.Partitions}. + * * In contrast to the {@link RedisAdvancedClusterAsyncConnection}, node-connections do not route commands to other cluster * nodes * * @param nodeId the node Id * @return a connection to the requested cluster node + * @throws RedisException if the requested node identified by {@code nodeId} is not part of the cluster */ RedisClusterAsyncConnection getConnection(String nodeId); /** - * Retrieve a connection to the specified cluster node using the nodeId. In contrast to the - * {@link RedisAdvancedClusterAsyncConnection}, node-connections do not route commands to other cluster nodes + * Retrieve a connection to the specified cluster node using the nodeId. Do not close the connections. Otherwise, + * unpredictable behavior will occur. The node must be part of the cluster and host/port are validated (exact check) against + * the current topology view in {@link com.lambdaworks.redis.cluster.models.partitions.Partitions}. + * + * In contrast to the {@link RedisAdvancedClusterAsyncConnection}, node-connections do not route commands to other cluster + * nodes. * * @param host the host * @param port the port * @return a connection to the requested cluster node + * @throws RedisException if the requested node identified by {@code host} and {@code port} is not part of the cluster */ RedisClusterAsyncConnection getConnection(String host, int port); diff --git a/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterConnection.java b/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterConnection.java index 11c31144bb..58ff6adad8 100644 --- a/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterConnection.java +++ b/src/main/java/com/lambdaworks/redis/cluster/RedisAdvancedClusterConnection.java @@ -1,12 +1,8 @@ package com.lambdaworks.redis.cluster; -import java.util.function.Predicate; - import com.lambdaworks.redis.RedisClusterConnection; -import com.lambdaworks.redis.RedisFuture; +import com.lambdaworks.redis.RedisException; import com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection; -import com.lambdaworks.redis.cluster.models.partitions.Partitions; -import com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode; /** * Advanced synchronous and thread-safe cluster API. @@ -19,21 +15,30 @@ public interface RedisAdvancedClusterConnection extends RedisClusterConnection { /** - * Retrieve a connection to the specified cluster node using the nodeId. Host and port are looked up in the node list. In - * contrast to the {@link RedisAdvancedClusterConnection}, node-connections do not route commands to other cluster nodes + * Retrieve a connection to the specified cluster node using the nodeId. Host and port are looked up in the node list. + * + * Do not close the connections. Otherwise, unpredictable behavior will occur. The nodeId must be part of the cluster and is + * validated against the current topology view in {@link com.lambdaworks.redis.cluster.models.partitions.Partitions}. + * + * In contrast to the {@link RedisAdvancedClusterConnection}, node-connections do not route commands to other cluster nodes. * * @param nodeId the node Id * @return a connection to the requested cluster node + * @throws RedisException if the requested node identified by {@code nodeId} is not part of the cluster */ RedisClusterConnection getConnection(String nodeId); /** - * Retrieve a connection to the specified cluster node using the nodeId. In contrast to the - * {@link RedisAdvancedClusterConnection}, node-connections do not route commands to other cluster nodes + * Retrieve a connection to the specified cluster node using the nodeId. Do not close the connections. Otherwise, + * unpredictable behavior will occur. The node must be part of the cluster and host/port are validated (exact check) against + * the current topology view in {@link com.lambdaworks.redis.cluster.models.partitions.Partitions}. + * + * In contrast to the {@link RedisAdvancedClusterConnection}, node-connections do not route commands to other cluster nodes. * * @param host the host * @param port the port * @return a connection to the requested cluster node + * @throws RedisException if the requested node identified by {@code host} and {@code port} is not part of the cluster */ RedisClusterConnection getConnection(String host, int port); diff --git a/src/main/java/com/lambdaworks/redis/cluster/api/StatefulRedisClusterConnection.java b/src/main/java/com/lambdaworks/redis/cluster/api/StatefulRedisClusterConnection.java index b0a33d84f8..08b19751cf 100644 --- a/src/main/java/com/lambdaworks/redis/cluster/api/StatefulRedisClusterConnection.java +++ b/src/main/java/com/lambdaworks/redis/cluster/api/StatefulRedisClusterConnection.java @@ -1,5 +1,6 @@ package com.lambdaworks.redis.cluster.api; +import com.lambdaworks.redis.RedisException; import com.lambdaworks.redis.api.StatefulConnection; import com.lambdaworks.redis.api.StatefulRedisConnection; import com.lambdaworks.redis.cluster.RedisAdvancedClusterAsyncConnection; @@ -43,21 +44,32 @@ public interface StatefulRedisClusterConnection extends StatefulConnection RedisAdvancedClusterReactiveCommands reactive(); /** - * Retrieve a stateful connection to the specified cluster node using the nodeId. Host and port are looked up in the node - * list. In contrast to the RedisAdvancedClusterConnection, node-connections do not route commands to other cluster nodes. - * + * Retrieve a connection to the specified cluster node using the nodeId. Host and port are looked up in the node list. + * + * Do not close the connections. Otherwise, unpredictable behavior will occur. The nodeId must be part of the cluster and is + * validated against the current topology view in {@link com.lambdaworks.redis.cluster.models.partitions.Partitions}. + * + * In contrast to the {@link StatefulRedisClusterConnection}, node-connections do not route commands to other cluster + * nodes. + * * @param nodeId the node Id * @return a connection to the requested cluster node + * @throws RedisException if the requested node identified by {@code nodeId} is not part of the cluster */ StatefulRedisConnection getConnection(String nodeId); /** - * Retrieve a stateful connection to the specified cluster node using the nodeId. In contrast to the - * RedisAdvancedClusterConnection, node-connections do not route commands to other cluster nodes. + * Retrieve a connection to the specified cluster node using the nodeId. Do not close the connections. Otherwise, + * unpredictable behavior will occur. The node must be part of the cluster and host/port are validated (exact check) against + * the current topology view in {@link com.lambdaworks.redis.cluster.models.partitions.Partitions}. + * + * In contrast to the {@link StatefulRedisClusterConnection}, node-connections do not route commands to other cluster + * nodes. * * @param host the host * @param port the port * @return a connection to the requested cluster node + * @throws RedisException if the requested node identified by {@code host} and {@code port} is not part of the cluster */ StatefulRedisConnection getConnection(String host, int port);