Skip to content

Commit 9dc40d5

Browse files
jebeaudetmarcosnils
authored andcommitted
Backport of gh-1935 to fix the connection leak. Fixes gh-1945 (#1947)
1 parent 89cb811 commit 9dc40d5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/redis/clients/jedis/Jedis.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,12 +3500,13 @@ public Map<String, String> pubsubNumSub(String... channels) {
35003500
@Override
35013501
public void close() {
35023502
if (dataSource != null) {
3503+
Pool<Jedis> pool = this.dataSource;
3504+
this.dataSource = null;
35033505
if (client.isBroken()) {
3504-
this.dataSource.returnBrokenResource(this);
3506+
pool.returnBrokenResource(this);
35053507
} else {
3506-
this.dataSource.returnResource(this);
3508+
pool.returnResource(this);
35073509
}
3508-
this.dataSource = null;
35093510
} else {
35103511
super.close();
35113512
}

0 commit comments

Comments
 (0)