Skip to content

Commit 760d857

Browse files
committed
Update connection pool. Set maxIdle=1, but only evict connections older than an hour
1 parent 87992cd commit 760d857

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

readme.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ Right now, all session destruction and cache eviction notices are directed all a
4646

4747
## Major Changes
4848

49+
- 1.0.2
50+
- Changed connection pool parameters to slow down idle connection eviction (need to make these customizable)
51+
4952
- 1.0.1
5053
- Initial Release
5154
- Batches up Redis operations to be executed as single Redis operation
@@ -99,7 +102,7 @@ See the pom.xml. Any library marked as `compile` scope must be present on the cl
99102
<libs>
100103
<!-- Note TomEE includes commons-lang3 by default; here for completeness -->
101104
<!-- <lib>org.apache.commons:commons-lang3:3.12.0</lib> -->
102-
<lib>com.github.exabrial:redex-sm:1.0.1</lib>
105+
<lib>com.github.exabrial:redex-sm:1.0.2</lib>
103106
<lib>redis.clients:jedis:4.4.3</lib>
104107
</libs>
105108
</configuration>

src/main/java/com/github/exabrial/redexsm/jedis/JedisRedisService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ public JedisRedisService(final String url, final String keyPrefix, final String
7575
public void start(final SessionRemover sessionRemover) {
7676
final ConnectionPoolConfig poolConfig = new ConnectionPoolConfig();
7777
poolConfig.setMinIdle(1);
78-
poolConfig.setMaxIdle(3);
78+
poolConfig.setMaxIdle(1);
7979
poolConfig.setMaxTotal(15);
8080
poolConfig.setMaxWait(Duration.of(5000, ChronoUnit.MILLIS));
8181
poolConfig.setJmxEnabled(true);
82+
poolConfig.setMinEvictableIdleTime(Duration.of(1, ChronoUnit.HOURS));
8283
poolConfig.setBlockWhenExhausted(true);
8384
this.jedis = new JedisPooled(poolConfig, url);
8485
destructionListener = new SessionDestructionListener(sessionRemover, jedis, REDEX_SESSION_DESTRUCTION + keyPrefix, nodeId);

0 commit comments

Comments
 (0)