Skip to content

DOC-7226 Move the job-queue Jedis use case to RedisClient - #4391

Merged
andy-stark-redis merged 1 commit into
mainfrom
DOC-7226-jedis-pool-e
Oct 30, 2026
Merged

andy-stark-redis merged 1 commit into
mainfrom
DOC-7226-jedis-pool-e

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Moves the job-queue java-jedis use case from JedisPool to RedisClient (Jedis 8.0.2).

Stacked on #4384, which edits the same lines. The base is that PR's branch, so GitHub retargets this to main when #4384 merges; it may need a rebase then.

Verified: 0 deprecation warnings; an 11-step scenario (drain, hang, reclaim, fail, 500 concurrent enqueues) gives byte-identical output to #4384's JedisPool code on the same jar. Not run: Hugo build.

Part of DOC-7226.

🤖 Generated with Claude Code


Note

Low Risk
Documentation and demo-only Java in the redis/docs repo; behavior was verified against the prior JedisPool implementation with no queue logic changes.

Overview
Migrates the java-jedis job-queue demo and docs from JedisPool / per-call getResource() to Jedis 8’s RedisClient, without changing queue semantics (Lua scripts, BLMOVE, reclaim, etc.).

DemoServer now builds a pooled client with ConnectionPoolConfig and RedisClient.builder(), pings Redis on startup, and closes jedis on shutdown instead of jedisPool. RedisJobQueue takes a RedisClient, calls Redis directly on that client, and uses try (Pipeline pipe = jedis.pipelined()) instead of borrowing a Jedis from the pool for each operation.

_index.md updates sample code, connection-pooling guidance, prerequisites, and compile/run classpath lines for Jedis 8.0.2 and its extra runtime jars.

Reviewed by Cursor Bugbot for commit f0fa1bd. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 7 related items from repository history (2 new this commit):

Memory updated at f0fa1bd

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

DOC-7226

@github-actions

Copy link
Copy Markdown
Contributor

@andy-stark-redis
andy-stark-redis requested a review from a team October 30, 2026 13:01
@andy-stark-redis andy-stark-redis self-assigned this Oct 30, 2026
@andy-stark-redis andy-stark-redis added the clients Client library docs label Oct 30, 2026

@dwdougherty dwdougherty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Skimmed. Approved.

Base automatically changed from DOC-7226-job-queue-blmove to main October 30, 2026 13:35
RedisJobQueue and DemoServer take a RedisClient instead of a JedisPool. The
getResource() blocks are gone, the three pipelines are in try-with-resources, and
DemoServer builds the client with RedisClient.builder() and a ConnectionPoolConfig
(maxTotal 32, maxIdle 16, minIdle 2, as before). The page's snippets, Maven/Gradle
version (5.0.1 -> 8.0.2), prerequisites, pool-sizing section and javac/java commands
(now the six runtime jars) follow.

Stacked on #4384 (DOC-7226-job-queue-blmove), which rewrites the claim() call and
the connection-handling prose in these same files. This branch must be rebased onto
main after #4384 merges; until then the diff against main also shows #4384's change.

Three pipelines read their Response after the try block (claim, stats), so those
Response variables are declared before it. sync() resolves them, so reading after
close is fine.

Verification: compiles with -Xlint:deprecation, zero warnings, against Jedis
8.0.2 (blmove from #4384 included). The baseline is #4384's code (JedisPool) run on
the same jedis-8.0.2 jar, which still ships JedisPool, so only my change differs.
The same 11-step scenario ran on both against redis:8.10 with --visibility-ms 1500
and gave byte-identical output: enqueue 20 and drain with 3 workers; hang_rate=1 so 4
jobs stay in processing; /reclaim moves them back and workers complete them
(reclaimed_total=4); fail_rate=1 sends 3 jobs to failed after retries; 20 concurrent
enqueues of 25 (500 jobs) all complete. The page's javac/java commands were
extracted and run literally in a clean directory with the six jars.

Constraint: stats() and claim() pipelines hold a pooled connection until closed; their Response objects stay valid after close
Learned: a rename script that turns JedisPool into RedisClient also turns "new JedisPool(...)" into "new RedisClient(...)", which does not exist; grep for it after any bulk rename
Learned: git grep with a "*" pathspec like content/.../*/java-jedis returned nothing silently; use a plain directory and filter the output, and run a control that must produce hits
Ticket: DOC-7226
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@andy-stark-redis
andy-stark-redis merged commit 4762009 into main Oct 30, 2026
107 checks passed
@andy-stark-redis
andy-stark-redis deleted the DOC-7226-jedis-pool-e branch October 30, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients Client library docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants