-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3629,10 +3629,12 @@ public Map<String, String> pubsubNumSub(String... channels) { | |
@Override | ||
public void close() { | ||
if (dataSource != null) { | ||
Pool<Jedis> pool = this.dataSource; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gkorland
Author
Contributor
|
||
this.dataSource = null; | ||
if (client.isBroken()) { | ||
this.dataSource.returnBrokenResource(this); | ||
pool.returnBrokenResource(this); | ||
} else { | ||
this.dataSource.returnResource(this); | ||
pool.returnResource(this); | ||
} | ||
this.dataSource = null; | ||
This comment has been minimized.
Sorry, something went wrong.
sazzad16
Collaborator
|
||
} else { | ||
|
As long as access to this.dataSource is not protected by some memory barrier (synchronized, volatile), this won't help for race conditions.
I.e. the JVM is allowed to reorder the instructions.
Making this.dataSource volatile would IMO help, though.