ss: Speed up TreeMapStore#add()
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.segmentstore.core / src / org / eclipse / tracecompass / segmentstore / core / treemap / TreeMapStore.java
index 1632d91c041f5a373b4b7a98ce6ad7fe687f2323..fa5b2b8616bc9f26181188df7d5b27f948c919c0 100644 (file)
@@ -117,20 +117,16 @@ public class TreeMapStore<E extends ISegment> implements ISegmentStore<E> {
 
         fLock.writeLock().lock();
         try {
-            /* We can take a read lock while holding the write lock. */
-            if (contains(val)) {
-                return false;
-            }
-
             if (fStartTimesIndex.put(Long.valueOf(val.getStart()), val)) {
                 fEndTimesIndex.put(Long.valueOf(val.getEnd()), val);
                 fSize++;
                 fLastSnapshot = null;
+                return true;
             }
+            return false;
         } finally {
             fLock.writeLock().unlock();
         }
-        return true;
     }
 
     @Override
This page took 0.024685 seconds and 5 git commands to generate.