mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-07 18:48:39 +00:00
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 @@ static void register(Object value) {
|
||||
* @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…
x
Reference in New Issue
Block a user