Skip to content

Commit 191e9b8

Browse files
timothyzhwmarcosnils
authored andcommitted
Reset shardjedis datasource (#1939)
Reset shardjedis dataSource before returned to pool Related to #1920 As it had fixed in Jedis.java, SharedJedis.java should be fixed too.
1 parent af9a05b commit 191e9b8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ public Long bitpos(final String key, boolean value, final BitPosParams params) {
799799
/**
800800
* This method is deprecated due to bug (scan cursor should be unsigned long)
801801
* And will be removed on next major release
802-
* @see https://github.com/xetorthio/jedis/issues/531
802+
* @see https://github.com/xetorthio/jedis/issues/531
803803
*/
804804
public ScanResult<Entry<String, String>> hscan(String key, int cursor) {
805805
Jedis j = getShard(key);
@@ -810,7 +810,7 @@ public ScanResult<Entry<String, String>> hscan(String key, int cursor) {
810810
/**
811811
* This method is deprecated due to bug (scan cursor should be unsigned long)
812812
* And will be removed on next major release
813-
* @see https://github.com/xetorthio/jedis/issues/531
813+
* @see https://github.com/xetorthio/jedis/issues/531
814814
*/
815815
public ScanResult<String> sscan(String key, int cursor) {
816816
Jedis j = getShard(key);
@@ -821,7 +821,7 @@ public ScanResult<String> sscan(String key, int cursor) {
821821
/**
822822
* This method is deprecated due to bug (scan cursor should be unsigned long)
823823
* And will be removed on next major release
824-
* @see https://github.com/xetorthio/jedis/issues/531
824+
* @see https://github.com/xetorthio/jedis/issues/531
825825
*/
826826
public ScanResult<Tuple> zscan(String key, int cursor) {
827827
Jedis j = getShard(key);
@@ -875,13 +875,13 @@ public void close() {
875875
break;
876876
}
877877
}
878-
878+
Pool<ShardedJedis> pool = this.dataSource;
879+
this.dataSource = null;
879880
if (broken) {
880-
dataSource.returnBrokenResource(this);
881+
pool.returnBrokenResource(this);
881882
} else {
882-
dataSource.returnResource(this);
883+
pool.returnResource(this);
883884
}
884-
this.dataSource = null;
885885

886886
} else {
887887
disconnect();

0 commit comments

Comments
 (0)