Author: ron.sigal(a)jboss.com
Date: 2010-08-31 11:48:20 -0400 (Tue, 31 Aug 2010)
New Revision: 6078
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/CopyOnWriteHashMap.java
Log:
JBREM-1244: remove() and replace() with current value arguments now test against the
current value before updating the map.
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/CopyOnWriteHashMap.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/CopyOnWriteHashMap.java 2010-08-31
15:12:35 UTC (rev 6077)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/CopyOnWriteHashMap.java 2010-08-31
15:48:20 UTC (rev 6078)
@@ -80,7 +80,7 @@
synchronized (writeLock) {
final Map<K, V> map = this.map;
final V old = map.get(key);
- if (old == null) {
+ if (old == null || old != value && !old.equals(value)) {
return false;
}
if (map.size() == 1) {
@@ -102,7 +102,7 @@
synchronized (writeLock) {
final Map<K, V> map = this.map;
final V old = map.get(key);
- if (old == null) {
+ if (old == null || old != oldValue && !old.equals(oldValue)) {
return false;
}
if (map.size() == 1) {