diff --git a/java/client/src/main/java/glide/api/commands/ConnectionManagementBaseCommands.java b/java/client/src/main/java/glide/api/commands/ConnectionManagementBaseCommands.java index 36b6fe6957..0eeaaccddc 100644 --- a/java/client/src/main/java/glide/api/commands/ConnectionManagementBaseCommands.java +++ b/java/client/src/main/java/glide/api/commands/ConnectionManagementBaseCommands.java @@ -33,6 +33,11 @@ public interface ConnectionManagementBaseCommands { * * @see redis.io for details. * @return The id of the client. + * @example + *
+     * long id = client.clientId().get();
+     * assert id > 0
+     * 
*/ CompletableFuture clientId(); @@ -42,6 +47,11 @@ public interface ConnectionManagementBaseCommands { * @see redis.io for details. * @return The name of the client connection as a string if a name is set, or null if * no name is assigned. + * @example + *
+     * String clientName = client.clientGetName().get();
+     * assert clientName != null
+     * 
*/ CompletableFuture clientGetName(); } diff --git a/java/client/src/main/java/glide/api/commands/ConnectionManagementClusterCommands.java b/java/client/src/main/java/glide/api/commands/ConnectionManagementClusterCommands.java index d363042c83..79d7aeefd7 100644 --- a/java/client/src/main/java/glide/api/commands/ConnectionManagementClusterCommands.java +++ b/java/client/src/main/java/glide/api/commands/ConnectionManagementClusterCommands.java @@ -10,7 +10,7 @@ * * @see Connection Management Commands */ -public interface ConnectionManagementClusterCommands extends ConnectionManagementBaseCommands { +public interface ConnectionManagementClusterCommands { /** * Ping the Redis server. @@ -34,10 +34,33 @@ public interface ConnectionManagementClusterCommands extends ConnectionManagemen */ CompletableFuture ping(String str, Route route); - /** {@inheritDoc} The command will be routed a random node. */ + /** + * Get the current connection id.
+ * The command will be routed a random node. + * + * @see redis.io for details. + * @return The id of the client. + * @example + *
+     * long id = client.clientId().get();
+     * assert id > 0
+     * 
+ */ CompletableFuture clientId(); - /** {@inheritDoc} The command will be routed a random node. */ + /** + * Get the name of the current connection.
+ * The command will be routed a random node. + * + * @see redis.io for details. + * @return The name of the client connection as a string if a name is set, or null if + * no name is assigned. + * @example + *
+     * String clientName = client.clientGetName().get();
+     * assert clientName != null
+     * 
+ */ CompletableFuture clientGetName(); /** @@ -49,6 +72,17 @@ public interface ConnectionManagementClusterCommands extends ConnectionManagemen * @return A {@link ClusterValue} which holds a single value if single node route is used or a * dictionary where each address is the key and its corresponding node response is the value. * The value is the id of the client on that node. + * @example + *
+     * long id = client.clientId(new SlotIdRoute(...)).get().getSingleValue();
+     * assert id > 0
+     * 
+ * + * @example + *
+     * Map<String, Long> idPerNode = client.clientId(ALL_NODES).get().getMultiValue();
+     * assert idPerNode.get("<node 1 address>") > 0
+     * 
*/ CompletableFuture> clientId(Route route); @@ -62,6 +96,17 @@ public interface ConnectionManagementClusterCommands extends ConnectionManagemen * dictionary where each address is the key and its corresponding node response is the value. * The value is the name of the client connection as a string if a name is set, or null if no * name is assigned. + * @example + *
+     * String clientName = client.clientGetName(new SlotIdRoute(...)).get().getSingleValue();
+     * assert clientName != null
+     * 
+ * + * @example + *
+     * Map<String, String> clientNamePerNode = client.clientGetName(ALL_NODES).get().getMultiValue();
+     * assert clientNamePerNode.get("<node 1 address>") != null
+     * 
*/ CompletableFuture> clientGetName(Route route); }