summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/map/MapStorage.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java b/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java
index 27934ef..e700bd7 100644
--- a/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java
+++ b/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java
@@ -322,15 +322,15 @@ class MapStorage<S extends Storable>
// Caller must hold upgrade or write lock.
private boolean doTryInsertNoLock(S storable) {
- Key<S> key = new Key<S>(storable, mFullComparator);
- S existing = mMap.get(key);
- if (existing != null) {
- return false;
- }
// Create a fresh copy to ensure that custom fields are not saved.
S copy = (S) storable.prepare();
storable.copyAllProperties(copy);
copy.markAllPropertiesClean();
+ Key<S> key = new Key<S>(copy, mFullComparator);
+ S existing = mMap.get(key);
+ if (existing != null) {
+ return false;
+ }
mMap.put(key, copy);
storable.markAllPropertiesClean();
return true;