Index: branches/ehcache-2.8.x/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/SerializedReadCommittedClusteredSoftLock.java =================================================================== diff -u -N -r8519 -r8785 --- branches/ehcache-2.8.x/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/SerializedReadCommittedClusteredSoftLock.java (.../SerializedReadCommittedClusteredSoftLock.java) (revision 8519) +++ branches/ehcache-2.8.x/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/SerializedReadCommittedClusteredSoftLock.java (.../SerializedReadCommittedClusteredSoftLock.java) (revision 8785) @@ -31,4 +31,27 @@ return rv; } + @Override + public boolean equals(Object object) { + if (object instanceof SerializedReadCommittedClusteredSoftLock) { + SerializedReadCommittedClusteredSoftLock other = (SerializedReadCommittedClusteredSoftLock) object; + + if (!transactionID.equals(other.transactionID)) { return false; } + if (!deserializedKey.equals(other.deserializedKey)) { return false; } + + return true; + } + return false; + } + + @Override + public int hashCode() { + int hashCode = 31; + + hashCode *= transactionID.hashCode(); + hashCode *= deserializedKey.hashCode(); + + return hashCode; + } + } Index: branches/ehcache-2.8.x/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/ReadCommittedClusteredSoftLockFactory.java =================================================================== diff -u -N -r8519 -r8785 --- branches/ehcache-2.8.x/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/ReadCommittedClusteredSoftLockFactory.java (.../ReadCommittedClusteredSoftLockFactory.java) (revision 8519) +++ branches/ehcache-2.8.x/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/ReadCommittedClusteredSoftLockFactory.java (.../ReadCommittedClusteredSoftLockFactory.java) (revision 8785) @@ -131,26 +131,15 @@ @Override public void clearSoftLock(SoftLock softLock) { - for (SerializedReadCommittedClusteredSoftLock serializedSoftLock : newKeyLocks.keySet()) { - if (serializedSoftLock.getSoftLock(toolkitInstanceFactory, this).equals(softLock)) { - newKeyLocks.remove(serializedSoftLock); - break; - } - } - - for (Map.Entry entry : allLocks.entrySet()) { - if (entry.getValue().getSoftLock(toolkitInstanceFactory, this).equals(softLock)) { - allLocks.remove(entry.getKey()); - break; - } - } + SoftLockID softLockId = new SoftLockID(((ReadCommittedClusteredSoftLock)softLock).getTransactionID(), softLock.getKey(), null, null); + ClusteredSoftLockIDKey clusteredIdKey = new ClusteredSoftLockIDKey(softLockId); + SerializedReadCommittedClusteredSoftLock serializedClusteredSoftLock = allLocks.remove(clusteredIdKey); + newKeyLocks.remove(serializedClusteredSoftLock); } private Set getNewKeys() { Set result = new HashSet(); - int i = 0; for (SerializedReadCommittedClusteredSoftLock serialized : newKeyLocks.keySet()) { - newKeyLocks.get(i); // workaround for DEV-5390 result.add(serialized.getSoftLock(toolkitInstanceFactory, this).getKey()); }