Author: mbenson
Date: Sun Feb 7 03:42:08 2010
New Revision: 907375
URL: http://svn.apache.org/viewvc?rev=907375&view=rev
Log:
reread ThreadLocal value in synchronized block to avoid any timing issues
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
URL:
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java?rev=907375&r1=907374&r2=907375&view=diff
==============================================================================
---
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
(original)
+++
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
Sun Feb 7 03:42:08 2010
@@ -536,11 +536,13 @@
* @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();
}
}