Skip to content

Commit

Permalink
Reset shardjedis datasource (#1939)
Browse files Browse the repository at this point in the history
Reset shardjedis dataSource before returned to pool

Related to #1920
As it had fixed in Jedis.java, SharedJedis.java should be fixed too.
  • Loading branch information
timothyzhw authored and marcosnils committed May 19, 2019
1 parent af9a05b commit 191e9b8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/redis/clients/jedis/ShardedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ public Long bitpos(final String key, boolean value, final BitPosParams params) {
/**
* This method is deprecated due to bug (scan cursor should be unsigned long)
* And will be removed on next major release
* @see https://github.com/xetorthio/jedis/issues/531
* @see https://github.com/xetorthio/jedis/issues/531
*/
public ScanResult<Entry<String, String>> hscan(String key, int cursor) {
Jedis j = getShard(key);
Expand All @@ -810,7 +810,7 @@ public ScanResult<Entry<String, String>> hscan(String key, int cursor) {
/**
* This method is deprecated due to bug (scan cursor should be unsigned long)
* And will be removed on next major release
* @see https://github.com/xetorthio/jedis/issues/531
* @see https://github.com/xetorthio/jedis/issues/531
*/
public ScanResult<String> sscan(String key, int cursor) {
Jedis j = getShard(key);
Expand All @@ -821,7 +821,7 @@ public ScanResult<String> sscan(String key, int cursor) {
/**
* This method is deprecated due to bug (scan cursor should be unsigned long)
* And will be removed on next major release
* @see https://github.com/xetorthio/jedis/issues/531
* @see https://github.com/xetorthio/jedis/issues/531
*/
public ScanResult<Tuple> zscan(String key, int cursor) {
Jedis j = getShard(key);
Expand Down Expand Up @@ -875,13 +875,13 @@ public void close() {
break;
}
}

Pool<ShardedJedis> pool = this.dataSource;
this.dataSource = null;
if (broken) {
dataSource.returnBrokenResource(this);
pool.returnBrokenResource(this);
} else {
dataSource.returnResource(this);
pool.returnResource(this);
}
this.dataSource = null;

} else {
disconnect();
Expand Down

0 comments on commit 191e9b8

Please sign in to comment.