Skip to content

Java: Lazy connect implementation #4370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

affonsov
Copy link
Collaborator

@affonsov affonsov commented Jul 14, 2025

This PR implements lazy connection functionality for the Java client, allowing client creation by deferring connection establishment until the first operation.

Changes:

  • BaseClientConfiguration: Added lazy connection configuration option
  • ConnectionManager: Enhanced to support deferred connection establishment
  • Test Coverage: Added integration tests for lazy connection behavior

Key Features:

  • Client can be instantiated without immediate server connection
  • Connection is established on first command execution
  • Test coverage for both standalone and cluster scenarios

Issue link

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

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.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Create merge commit if merging release branch into main, squash otherwise.

@affonsov affonsov requested a review from a team as a code owner July 14, 2025 23:01
@affonsov affonsov changed the title Javaj: Lazy connect implementation Java: Lazy connect implementation Jul 14, 2025
@affonsov affonsov force-pushed the java/affonsov-lazy-connect branch from c3cbc99 to 9155395 Compare July 15, 2025 16:32
@Yury-Fridlyand Yury-Fridlyand added the java ☕ issues and fixes related to the java client label Jul 15, 2025
Copy link
Collaborator

@jduo jduo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider making ValkeyCluster an AutoCloseable instead of relying on finalize() for clean-up

Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add configure git to auto-add DCO to all commits and re-create commits, so they will be signed.

@meitalkra meitalkra added this to the 2.1 milestone Jul 17, 2025
@affonsov affonsov force-pushed the java/affonsov-lazy-connect branch from 7a2e468 to 6c65c29 Compare July 17, 2025 18:31
@Yury-Fridlyand
Copy link
Collaborator

Please add a changelog entry

affonsov added 5 commits July 18, 2025 15:40
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
- Fix Javadoc formatting in BaseClientConfiguration to use proper {@code} tags
- Implement AutoCloseable in ValkeyCluster for proper resource management
- Add try-with-resources usage in ConnectionTests for automatic cleanup

Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
Signed-off-by: affonsov <67347924+affonsov@users.noreply.github.com>
@affonsov affonsov force-pushed the java/affonsov-lazy-connect branch from 6c65c29 to b21e811 Compare July 18, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java ☕ issues and fixes related to the java client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java: Enable creation and termination of Valkey clusters during test
4 participants