Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-12-15 13:54:39 -0500
committerEike Stepper2011-12-15 13:54:39 -0500
commit1aa65ceed574a4dbb1aa8f852fbf8dd5ec25c8be (patch)
treee1fb6342054876db0de57fef2c8a4412761d44ed
parent51d24d76353302014f8fe1ea32a14d0836f73952 (diff)
downloadcdo-1aa65ceed574a4dbb1aa8f852fbf8dd5ec25c8be.tar.gz
cdo-1aa65ceed574a4dbb1aa8f852fbf8dd5ec25c8be.tar.xz
cdo-1aa65ceed574a4dbb1aa8f852fbf8dd5ec25c8be.zip
[366066] Double refresh breaks model consistency
https://bugs.eclipse.org/bugs/show_bug.cgi?id=366066
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java55
1 files changed, 39 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
index 9600474611..281ec3cc9d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
@@ -396,28 +396,51 @@ public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevi
{
if (revision != null)
{
- if (revision instanceof PointerCDORevision)
+ acquireAtomicRequestLock(loadAndAddLock);
+
+ try
{
- PointerCDORevision pointer = (PointerCDORevision)revision;
- CDOBranchVersion target = pointer.getTarget();
- if (target instanceof InternalCDORevision)
+ if (revision instanceof PointerCDORevision)
{
- revision = new PointerCDORevision(pointer.getEClass(), pointer.getID(), pointer.getBranch(),
- pointer.getRevised(), CDOBranchUtil.copyBranchVersion(target));
+ PointerCDORevision pointer = (PointerCDORevision)revision;
+ CDOBranchVersion target = pointer.getTarget();
+ if (target instanceof InternalCDORevision)
+ {
+ revision = new PointerCDORevision(pointer.getEClass(), pointer.getID(), pointer.getBranch(),
+ pointer.getRevised(), CDOBranchUtil.copyBranchVersion(target));
+ }
}
- }
-
- cache.addRevision(revision);
- int oldVersion = revision.getVersion() - 1;
- if (oldVersion >= CDORevision.UNSPECIFIED_VERSION)
- {
- CDOBranchVersion old = revision.getBranch().getVersion(oldVersion);
- InternalCDORevision oldRevision = getCachedRevisionByVersion(revision.getID(), old);
- if (oldRevision != null && oldRevision.getRevised() == CDOBranchPoint.UNSPECIFIED_DATE)
+ int oldVersion = revision.getVersion() - 1;
+ if (oldVersion >= CDORevision.UNSPECIFIED_VERSION)
{
- oldRevision.setRevised(revision.getTimeStamp() - 1);
+ CDOBranchVersion old = revision.getBranch().getVersion(oldVersion);
+ InternalCDORevision oldRevision = getCachedRevisionByVersion(revision.getID(), old);
+ if (!revision.isHistorical())
+ {
+ if (oldRevision != null)
+ {
+ oldRevision.setRevised(revision.getTimeStamp() - 1);
+ }
+ else
+ {
+ // Remove last revision from cache, which is not revised
+ InternalCDORevision cachedLatestRevision = getCachedRevision(revision.getID(), revision);
+ if (cachedLatestRevision != null && !cachedLatestRevision.isHistorical())
+ {
+ // Found revision is stale.
+ // We cannot revise it now because of lack information, thus remove it from the cache
+ cache.removeRevision(cachedLatestRevision.getID(), cachedLatestRevision);
+ }
+ }
+ }
}
+
+ cache.addRevision(revision);
+ }
+ finally
+ {
+ releaseAtomicRequestLock(loadAndAddLock);
}
}
}

Back to the top