Skip to content

Conversation

@pratheep-kumar
Copy link
Contributor

@pratheep-kumar pratheep-kumar commented Jan 5, 2026

Issue link

This Pull Request is linked to issue (URL): #5117

Description

This PR implements comprehensive support for 20 connection management commands in the Java client, providing feature parity with Python, Node.js, and Go clients, as well as industry-standard clients like Lettuce.

Summary of Changes

Commands Implemented:

  • ✅ Authentication: AUTH (password and username/password variants)
  • ✅ Protocol Management: HELLO (with auth and client name options)
  • ✅ Client Identity: CLIENT SETNAME, CLIENT GETNAME, CLIENT ID, CLIENT INFO, CLIENT SETINFO
  • ✅ Client Management: CLIENT LIST, CLIENT KILL, CLIENT UNBLOCK, CLIENT PAUSE, CLIENT UNPAUSE
  • ✅ Client Caching: CLIENT CACHING, CLIENT GETREDIR, CLIENT TRACKINGINFO
  • ✅ Client Behavior: CLIENT NO-EVICT, CLIENT NO-TOUCH, CLIENT REPLY
  • ✅ Connection Utils: ECHO, PING, SELECT, RESET, QUIT

Files Modified

Interfaces:

  • valkey-glide/java/client/src/main/java/glide/api/commands/ConnectionManagementCommands.java (NEW)
  • valkey-glide/java/client/src/main/java/glide/api/commands/ConnectionManagementClusterCommands.java (NEW)

Client Implementations:

  • valkey-glide/java/client/src/main/java/glide/api/GlideClient.java (implements ConnectionManagementCommands)
  • valkey-glide/java/client/src/main/java/glide/api/GlideClusterClient.java (implements ConnectionManagementClusterCommands)
  • valkey-glide/java/client/src/main/java/glide/api/BaseClient.java (core implementation)

Tests:

  • valkey-glide/java/integTest/src/test/java/glide/ConnectionManagementCommandsTests.java (NEW)
  • valkey-glide/java/integTest/src/test/java/glide/ConnectionManagementClusterCommandsTests.java (NEW)

Documentation:

  • CHANGELOG.md (updated with new features)

Test Coverage

Test Statistics:

  • 68 test methods (17 standalone + 26 cluster, with 25 routing variants)
  • 138 test executions (parameterized for TLS/non-TLS)
  • 100% pass rate - All active tests passing

Version Compatibility Tests:

  • ✅ Valkey 5.0+ features (CLIENT UNBLOCK)
  • ✅ Valkey 6.0+ features (AUTH username, HELLO, CLIENT CACHING)
  • ✅ Valkey 6.2+ features (CLIENT UNPAUSE, CLIENT TRACKINGINFO, RESET)
  • ✅ Valkey 7.0+ features (CLIENT NO-EVICT)
  • ✅ Valkey 7.2+ features (CLIENT NO-TOUCH, CLIENT SETINFO)

API Examples

Standalone Client:

// Authentication
client.auth("myPassword").get();
client.auth("myUser", "myPassword").get();

// Client identity
client.clientSetName("myConnection").get();
String name = client.clientGetName().get();
Long id = client.clientId().get();

// Client management
String clientList = client.clientList().get();
client.clientPause(1000).get();
client.clientUnpause().get();

// Binary-safe operations
GlideString binaryName = client.ping(gs("GLIDE")).get();
client.auth(gs("myUser"), gs("myPassword")).get();

// Connection management
String pong = client.ping().get();
String echo = client.echo("Hello").get();
client.select(1).get();
client.reset().get();

Cluster Client:

// Route to specific nodes
String result = clusterClient.ping(RANDOM).get();

// Route to all nodes
ClusterValue<String> allResults = clusterClient.ping(ALL_NODES).get();
Map<String, String> perNode = allResults.getMultiValue();

// Client identity with routing
ClusterValue<Long> ids = clusterClient.clientId(ALL_PRIMARIES).get();
ClusterValue<String> info = clusterClient.clientInfo(RANDOM).get();

// Multi-node client management
String response = clusterClient.clientNoEvict(true, ALL_NODES).get();
String pauseAll = clusterClient.clientPause(1000, ALL_NODES).get();

Breaking Changes

None - This is a purely additive change that:

  • ✅ Adds new interfaces without modifying existing APIs
  • ✅ Extends existing client classes with new methods
  • ✅ Maintains backward compatibility with all existing code
  • ✅ Follows established patterns from other command groups

Migration Guide

For users coming from Lettuce:

Lettuce GLIDE Java
commands.auth("password") client.auth("password").get()
commands.clientSetname("name") client.clientSetName("name").get()
commands.clientList() client.clientList().get()
commands.ping() client.ping().get()

Cluster mode benefits:

// Lettuce - routing is hidden
commands.ping();

// GLIDE - explicit control
clusterClient.ping(ALL_NODES).get();  // All nodes
clusterClient.ping(RANDOM).get();      // Single random node

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
    • 68 new integration test methods
    • 138 test executions with parameterization
    • 100% pass rate on all active tests
    • Binary safety tests included
    • Cluster routing tests included
    • Version compatibility tests included
  • CHANGELOG.md and documentation files are updated.
    • CHANGELOG.md updated with new features
    • Comprehensive Javadoc for all 85 methods
    • Code examples in documentation
    • Version requirements documented
  • Destination branch is correct - main or release
    • Target: main branch
  • Create merge commit if merging release branch into main, squash otherwise.
    • Squash merge recommended (feature branch → main)

Additional Quality Checks

  • Code formatting with Spotless applied
  • All linter checks passing
  • No compilation errors or warnings
  • Protobuf compatibility verified
  • Binary safety validated with GlideString tests
  • Cluster routing validated with multi-node tests
  • Error handling tested for edge cases
  • Version gating tested across Valkey 5.0-8.0+
  • DCO signoff included in all commits

Testing Instructions

Run all tests:

cd valkey-glide/java
./gradlew :integTest:test --tests '*ConnectionManagement*'

Run specific test class:

./gradlew :integTest:test --tests 'ConnectionManagementCommandsTests' --rerun
./gradlew :integTest:test --tests 'ConnectionManagementClusterCommandsTests' --rerun

Run with TLS:

./gradlew :integTest:test --tests '*ConnectionManagement*' -Dtls=true

@pratheep-kumar pratheep-kumar marked this pull request as ready for review January 5, 2026 14:35
@pratheep-kumar pratheep-kumar requested a review from a team as a code owner January 5, 2026 14:35
@pratheep-kumar
Copy link
Contributor Author

@yipin-chen @alexr-bq @jduo Please review this. Thanks.

@xShinnRyuu xShinnRyuu linked an issue Jan 7, 2026 that may be closed by this pull request
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Java): Implement connection management commands

1 participant