Skip to content

Commit 1673e9f

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 d9b3134 commit 1673e9f

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
@@ -757,7 +757,7 @@ public Long bitpos(final String key, boolean value, final BitPosParams params) {
757757
/**
758758
* This method is deprecated due to bug (scan cursor should be unsigned long)
759759
* And will be removed on next major release
760-
* @see https://github.com/xetorthio/jedis/issues/531
760+
* @see https://github.com/xetorthio/jedis/issues/531
761761
*/
762762
public ScanResult<Entry<String, String>> hscan(String key, int cursor) {
763763
Jedis j = getShard(key);
@@ -768,7 +768,7 @@ public ScanResult<Entry<String, String>> hscan(String key, int cursor) {
768768
/**
769769
* This method is deprecated due to bug (scan cursor should be unsigned long)
770770
* And will be removed on next major release
771-
* @see https://github.com/xetorthio/jedis/issues/531
771+
* @see https://github.com/xetorthio/jedis/issues/531
772772
*/
773773
public ScanResult<String> sscan(String key, int cursor) {
774774
Jedis j = getShard(key);
@@ -779,7 +779,7 @@ public ScanResult<String> sscan(String key, int cursor) {
779779
/**
780780
* This method is deprecated due to bug (scan cursor should be unsigned long)
781781
* And will be removed on next major release
782-
* @see https://github.com/xetorthio/jedis/issues/531
782+
* @see https://github.com/xetorthio/jedis/issues/531
783783
*/
784784
public ScanResult<Tuple> zscan(String key, int cursor) {
785785
Jedis j = getShard(key);
@@ -833,13 +833,13 @@ public void close() {
833833
break;
834834
}
835835
}
836-
836+
Pool<ShardedJedis> pool = this.dataSource;
837+
this.dataSource = null;
837838
if (broken) {
838-
dataSource.returnBrokenResource(this);
839+
pool.returnBrokenResource(this);
839840
} else {
840-
dataSource.returnResource(this);
841+
pool.returnResource(this);
841842
}
842-
this.dataSource = null;
843843

844844
} else {
845845
disconnect();

0 commit comments

Comments
 (0)