reread ThreadLocal value in synchronized block to avoid any timing issues
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907375 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f35e7c99b
commit
76660f4a98
|
@ -536,11 +536,13 @@ public class HashCodeBuilder {
|
|||
* @since 2.3
|
||||
*/
|
||||
static void unregister(Object value) {
|
||||
Set<IDKey> s = getRegistry();
|
||||
if (s != null) {
|
||||
s.remove(new IDKey(value));
|
||||
Set<IDKey> registry = getRegistry();
|
||||
if (registry != null) {
|
||||
registry.remove(new IDKey(value));
|
||||
synchronized (HashCodeBuilder.class) {
|
||||
if (s.isEmpty()) {
|
||||
//read again
|
||||
registry = getRegistry();
|
||||
if (registry != null && registry.isEmpty()) {
|
||||
REGISTRY.remove();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue