Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2009-03-18 17:02:39 -0400
committerSimon McDuff2009-03-18 17:02:39 -0400
commita42224440ec030a9ce2fa38d9f3cf0cdb53e7323 (patch)
tree0f2f5d04566d684aa721ea55e3eb240888f1d39f /plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction
parent50180e82e4efbb0f869394c87cdeecb2ce809a36 (diff)
downloadcdo-a42224440ec030a9ce2fa38d9f3cf0cdb53e7323.tar.gz
cdo-a42224440ec030a9ce2fa38d9f3cf0cdb53e7323.tar.xz
cdo-a42224440ec030a9ce2fa38d9f3cf0cdb53e7323.zip
[258831] Check for Concurrency in CDOStateMachine
https://bugs.eclipse.org/bugs/show_bug.cgi?id=258831
Diffstat (limited to 'plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index 0dfe45740a..b30eaeef71 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -82,6 +82,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.concurrent.locks.ReentrantLock;
/**
* @author Eike Stepper
@@ -842,21 +843,33 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
throw new IllegalArgumentException("Savepoint isn't valid : " + savepoint);
}
- // Rollback objects
- Set<CDOID> idsOfNewObjectWithDeltas = rollbackCompletely(savepoint);
+ // Use the state lock since rollback mechanism is playing with EObject and CDORevisions. We do not want to
+ // receives notifications during that process! neither the user should callload any objects.
+ ReentrantLock viewLock = getStateLock();
+ viewLock.lock();
- lastSavepoint = (CDOSavepointImpl)savepoint;
- // Make savepoint active. Erase savepoint that could have be after
- lastSavepoint.setNextSavepoint(null);
- lastSavepoint.clear();
+ try
+ {
+ // Rollback objects
+ Set<CDOID> idsOfNewObjectWithDeltas = rollbackCompletely(savepoint);
- // Load from first savepoint up to current savepoint
- loadSavepoint(lastSavepoint, idsOfNewObjectWithDeltas);
+ lastSavepoint = (CDOSavepointImpl)savepoint;
+ // Make savepoint active. Erase savepoint that could have be after
+ lastSavepoint.setNextSavepoint(null);
+ lastSavepoint.clear();
- if (lastSavepoint == firstSavepoint && options().isAutoReleaseLocksEnabled())
+ // Load from first savepoint up to current savepoint
+ loadSavepoint(lastSavepoint, idsOfNewObjectWithDeltas);
+
+ if (lastSavepoint == firstSavepoint && options().isAutoReleaseLocksEnabled())
+ {
+ // Unlock all objects
+ unlockObjects(null, null);
+ }
+ }
+ finally
{
- // Unlock all objects
- unlockObjects(null, null);
+ viewLock.unlock();
}
Map<CDOIDTemp, CDOID> idMappings = Collections.emptyMap();

Back to the top