Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib-jedis-pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies {

- Full Redis URI parsing including database selection (`redis://host:6379/1`)
- SSL/TLS support (`rediss://` scheme)
- Configurable connection pool (minIdle, maxIdle, maxTotal)
- Configurable connection pool (minIdle, maxIdle, maxTotal, testOnBorrow)
- Optional password override via configuration
- Micrometer metrics integration (when MeterRegistry is available)
- Conditional activation via RedisActivator
Expand All @@ -31,6 +31,7 @@ redis:
minIdle: 0 # Default: 0
maxIdle: 10 # Default: 10
maxTotal: 50 # Default: 50
testOnBorrow: false # Default: false — PING-validate connections on borrow
client:
timeout: 5000 # Default: 5000ms
```
Expand Down
2 changes: 1 addition & 1 deletion lib-jedis-pool/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.1.0
3 changes: 3 additions & 0 deletions lib-jedis-pool/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# lib-jedis-pool changelog

1.1.0 - 21 Jul 2026
- Add redis.pool.testOnBorrow option to PING-validate connections on borrow and evict RESP-desynced connections

1.0.0 - 12 Jan 2026
- Initial release of lib-jedis-pool extracted from Wave project
- Add JedisPoolFactory for creating configured JedisPool beans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public JedisPool createRedisPool(
@Value("${redis.pool.minIdle:0}") int minIdle,
@Value("${redis.pool.maxIdle:10}") int maxIdle,
@Value("${redis.pool.maxTotal:50}") int maxTotal,
@Value("${redis.pool.testOnBorrow:false}") boolean testOnBorrow,
@Value("${redis.client.timeout:5000}") int timeout,
@Nullable @Value("${redis.password}") String password
) {
Expand All @@ -70,14 +71,17 @@ public JedisPool createRedisPool(
}
final int database = JedisURIHelper.getDBIndex(uri);

log.info("Creating Redis pool - uri={}; database={}; minIdle={}; maxIdle={}; maxTotal={}; timeout={}",
maskPassword(connection), database, minIdle, maxIdle, maxTotal, timeout);
log.info("Creating Redis pool - uri={}; database={}; minIdle={}; maxIdle={}; maxTotal={}; testOnBorrow={}; timeout={}",
maskPassword(connection), database, minIdle, maxIdle, maxTotal, testOnBorrow, timeout);

// Pool config
final JedisPoolConfig config = new JedisPoolConfig();
config.setMinIdle(minIdle);
config.setMaxIdle(maxIdle);
config.setMaxTotal(maxTotal);
// PING-validate connections on borrow so a RESP-desynced connection is evicted
// instead of served to the next caller — see libseqera#92 / platform#11820
config.setTestOnBorrow(testOnBorrow);

// Client config with database support
final JedisClientConfig clientConfig = clientConfig(uri, password, timeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class JedisPoolFactoryTest extends Specification {
def factory = new JedisPoolFactory(meterRegistry: Mock(MeterRegistry))

when:
def pool = factory.createRedisPool(URI_STRING, MIN_IDLE, MAX_IDLE, MAX_TOTAL, TIMEOUT, 'password')
def pool = factory.createRedisPool(URI_STRING, MIN_IDLE, MAX_IDLE, MAX_TOTAL, false, TIMEOUT, 'password')

then:
pool != null
Expand Down Expand Up @@ -75,7 +75,7 @@ class JedisPoolFactoryTest extends Specification {
def factory = new JedisPoolFactory(meterRegistry: Mock(MeterRegistry))

when:
factory.createRedisPool(URI_STRING, 0, 10, 50, 5000, null)
factory.createRedisPool(URI_STRING, 0, 10, 50, false, 5000, null)

then:
def e = thrown(InvalidURIException)
Expand All @@ -87,12 +87,29 @@ class JedisPoolFactoryTest extends Specification {
'localhost:6379' | _
}

def 'should enable testOnBorrow on the pool config'() {
given:
def factory = new JedisPoolFactory()

when:
def pool = factory.createRedisPool('redis://localhost:6379', 0, 10, 50, ON_BORROW, 5000, null)

then:
pool.testOnBorrow == ON_BORROW

cleanup:
pool?.close()

where:
ON_BORROW << [true, false]
}

def 'should create pool without meter registry'() {
given:
def factory = new JedisPoolFactory()

when:
def pool = factory.createRedisPool('redis://localhost:6379', 0, 10, 50, 5000, null)
def pool = factory.createRedisPool('redis://localhost:6379', 0, 10, 50, false, 5000, null)

then:
pool != null
Expand Down
Loading