Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-05-31 02:25:52 -0400
committerEike Stepper2013-05-31 02:25:52 -0400
commitd2b156d05dcdf7b9667567b3c8f6a7185d41f4c8 (patch)
tree34131632f0850e76dc4dafa150ffe77e86489a2c
parentb95a129e0800f82512efb166628d8ae357b3c113 (diff)
downloadcdo-d2b156d05dcdf7b9667567b3c8f6a7185d41f4c8.tar.gz
cdo-d2b156d05dcdf7b9667567b3c8f6a7185d41f4c8.tar.xz
cdo-d2b156d05dcdf7b9667567b3c8f6a7185d41f4c8.zip
[409549] Wrong branch manager is used in
SynchronizableRepository.handleCommitInfo() https://bugs.eclipse.org/bugs/show_bug.cgi?id=409549
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionConfiguration.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java4
14 files changed, 171 insertions, 46 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
index 2472a2d070..537017b176 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
@@ -27,6 +27,7 @@ import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.ref.ReferenceValueMap;
import org.eclipse.net4j.util.ref.ReferenceValueMap.Soft;
+import java.text.MessageFormat;
import java.util.Map;
/**
@@ -209,7 +210,7 @@ public class CDOBranchManagerImpl extends Container<CDOBranch> implements Intern
@Override
public String toString()
{
- return "BranchManager";
+ return MessageFormat.format("BranchManager[loader={0}]", branchLoader);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java
index 316af6f722..9fe666718f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java
@@ -13,6 +13,7 @@
package org.eclipse.emf.cdo.internal.common.revision;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
@@ -39,6 +40,8 @@ public abstract class AbstractCDORevisionCache extends ReferenceQueueWorker<Inte
private static boolean disableGC;
+ private CDOBranchManager branchManager;
+
private String name;
public AbstractCDORevisionCache()
@@ -46,6 +49,34 @@ public abstract class AbstractCDORevisionCache extends ReferenceQueueWorker<Inte
setDaemon(true);
}
+ public CDOBranchManager getBranchManager()
+ {
+ return branchManager;
+ }
+
+ public void setBranchManager(CDOBranchManager branchManager)
+ {
+ this.branchManager = branchManager;
+ }
+
+ protected final void checkBranch(CDOBranch branch)
+ {
+ if (branchManager != null)
+ {
+ CDOBranchManager actualBranchManager = branch.getBranchManager();
+ if (actualBranchManager != branchManager)
+ {
+ throw new IllegalArgumentException("Wrong branch manager: " + actualBranchManager + "; expected: "
+ + branchManager);
+ }
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
public void setName(String name)
{
this.name = name;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
index d38cf9bc30..703fc52fb4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
@@ -75,6 +75,8 @@ public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
{
+ checkBranch(branchPoint.getBranch());
+
RevisionList revisionList = getRevisionList(id, branchPoint.getBranch());
if (revisionList != null)
{
@@ -86,7 +88,10 @@ public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
{
- RevisionList revisionList = getRevisionList(id, branchVersion.getBranch());
+ CDOBranch branch = branchVersion.getBranch();
+ checkBranch(branch);
+
+ RevisionList revisionList = getRevisionList(id, branch);
if (revisionList != null)
{
return revisionList.getRevisionByVersion(branchVersion.getVersion());
@@ -129,8 +134,10 @@ public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
{
- List<CDORevision> result = new ArrayList<CDORevision>();
CDOBranch branch = branchPoint.getBranch();
+ checkBranch(branch);
+
+ List<CDORevision> result = new ArrayList<CDORevision>();
synchronized (revisionLists)
{
for (Map.Entry<Object, RevisionList> entry : revisionLists.entrySet())
@@ -155,8 +162,11 @@ public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
{
CheckUtil.checkArg(revision, "revision");
+ CDOBranch branch = revision.getBranch();
+ checkBranch(branch);
+
CDOID id = revision.getID();
- Object key = createKey(id, revision.getBranch());
+ Object key = createKey(id, branch);
synchronized (revisionLists)
{
@@ -174,7 +184,10 @@ public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
{
- Object key = createKey(id, branchVersion.getBranch());
+ CDOBranch branch = branchVersion.getBranch();
+ checkBranch(branch);
+
+ Object key = createKey(id, branch);
synchronized (revisionLists)
{
RevisionList list = revisionLists.get(key);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
index 33bcee9932..055bca4d54 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
@@ -67,6 +67,8 @@ public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
{
+ checkBranch(branchPoint.getBranch());
+
synchronized (revisions)
{
Reference<InternalCDORevision> ref = revisions.get(id);
@@ -85,6 +87,8 @@ public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
{
+ checkBranch(branchVersion.getBranch());
+
synchronized (revisions)
{
Reference<InternalCDORevision> ref = revisions.get(id);
@@ -145,7 +149,9 @@ public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
{
+ checkBranch(branchPoint.getBranch());
List<CDORevision> result = new ArrayList<CDORevision>();
+
synchronized (revisions)
{
for (Reference<InternalCDORevision> ref : revisions.values())
@@ -164,6 +170,8 @@ public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
public void addRevision(CDORevision revision)
{
CheckUtil.checkArg(revision, "revision");
+ checkBranch(revision.getBranch());
+
if (!revision.isHistorical())
{
Reference<InternalCDORevision> reference = createReference(revision);
@@ -176,6 +184,7 @@ public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
{
+ checkBranch(branchVersion.getBranch());
synchronized (revisions)
{
Reference<InternalCDORevision> ref = revisions.get(id);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java
index 9b824716ce..f2d4d3e665 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java
@@ -12,12 +12,15 @@ package org.eclipse.emf.cdo.spi.common.commit;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
import org.eclipse.emf.cdo.internal.common.commit.CDOCommitInfoManagerImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
@@ -55,6 +58,15 @@ public final class CDOCommitInfoUtil
/**
* @since 4.2
*/
+ public static CDOCommitData createCommitData(List<CDOPackageUnit> newPackageUnits, List<CDOIDAndVersion> newObjects,
+ List<CDORevisionKey> changedObjects, List<CDOIDAndVersion> detachedObjects)
+ {
+ return new CDOCommitDataImpl(newPackageUnits, newObjects, changedObjects, detachedObjects);
+ }
+
+ /**
+ * @since 4.2
+ */
public static long encodeCount(int count)
{
long timeStamp = count;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
index 510c43c5b6..e433098066 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/protocol/CDODataInputImpl.java
@@ -52,7 +52,6 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetDataImpl;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
import org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo;
import org.eclipse.emf.cdo.internal.common.lock.CDOLockAreaImpl;
import org.eclipse.emf.cdo.internal.common.lock.CDOLockChangeInfoImpl;
@@ -70,6 +69,7 @@ import org.eclipse.emf.cdo.internal.common.revision.delta.CDORemoveFeatureDeltaI
import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOSetFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOUnsetFeatureDeltaImpl;
+import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
@@ -262,7 +262,7 @@ public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating impl
}
CDOChangeSetData data = readCDOChangeSetData();
- return new CDOCommitDataImpl(newPackageUnits, data.getNewObjects(), data.getChangedObjects(),
+ return CDOCommitInfoUtil.createCommitData(newPackageUnits, data.getNewObjects(), data.getChangedObjects(),
data.getDetachedObjects());
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java
index aee4c9e617..59e503531a 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java
@@ -23,6 +23,7 @@ import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl.Repos
import org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol;
import org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest;
import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.session.CDORepositoryInfo;
import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
@@ -142,6 +143,8 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
}
super.doActivate();
+ CDORepositoryInfo repository = getRepositoryInfo();
+ CDOSessionProtocol sessionProtocol = getSessionProtocol();
InternalCDORevisionManager revisionManager = getRevisionManager();
if (revisionManager == null)
@@ -150,11 +153,14 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
setRevisionManager(revisionManager);
}
- revisionManager.setSupportingAudits(getRepositoryInfo().isSupportingAudits());
- revisionManager.setSupportingBranches(getRepositoryInfo().isSupportingBranches());
- revisionManager.setRevisionLoader(getSessionProtocol());
- revisionManager.setRevisionLocker(this);
- revisionManager.activate();
+ if (!revisionManager.isActive())
+ {
+ revisionManager.setSupportingAudits(repository.isSupportingAudits());
+ revisionManager.setSupportingBranches(repository.isSupportingBranches());
+ revisionManager.setRevisionLoader(sessionProtocol);
+ revisionManager.setRevisionLocker(this);
+ revisionManager.activate();
+ }
InternalCDOBranchManager branchManager = getBranchManager();
if (branchManager == null)
@@ -163,10 +169,13 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
setBranchManager(branchManager);
}
- branchManager.setRepository(getRepositoryInfo());
- branchManager.setBranchLoader(getSessionProtocol());
- branchManager.initMainBranch(isMainBranchLocal(), getRepositoryInfo().getCreationTime());
- branchManager.activate();
+ if (!branchManager.isActive())
+ {
+ branchManager.setRepository(repository);
+ branchManager.setBranchLoader(sessionProtocol);
+ branchManager.initMainBranch(isMainBranchLocal(), repository.getCreationTime());
+ branchManager.activate();
+ }
InternalCDOCommitInfoManager commitInfoManager = getCommitInfoManager();
if (commitInfoManager == null)
@@ -175,16 +184,19 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
setCommitInfoManager(commitInfoManager);
}
- commitInfoManager.setRepository(getRepositoryInfo());
- commitInfoManager.setCommitInfoLoader(getSessionProtocol());
- commitInfoManager.activate();
+ if (!commitInfoManager.isActive())
+ {
+ commitInfoManager.setRepository(repository);
+ commitInfoManager.setCommitInfoLoader(sessionProtocol);
+ commitInfoManager.activate();
+ }
for (InternalCDOPackageUnit packageUnit : result.getPackageUnits())
{
getPackageRegistry().putPackageUnit(packageUnit);
}
- getRepositoryInfo().getTimeStamp(true);
+ repository.getTimeStamp(true);
}
private CDOClientProtocol createProtocol()
@@ -206,15 +218,15 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
*/
private CDOClientProtocol getClientProtocol()
{
- CDOSessionProtocol protocol = getSessionProtocol();
+ CDOSessionProtocol sessionProtocol = getSessionProtocol();
CDOClientProtocol clientProtocol;
- if (protocol instanceof DelegatingSessionProtocol)
+ if (sessionProtocol instanceof DelegatingSessionProtocol)
{
- clientProtocol = (CDOClientProtocol)((DelegatingSessionProtocol)protocol).getDelegate();
+ clientProtocol = (CDOClientProtocol)((DelegatingSessionProtocol)sessionProtocol).getDelegate();
}
else
{
- clientProtocol = (CDOClientProtocol)protocol;
+ clientProtocol = (CDOClientProtocol)sessionProtocol;
}
return clientProtocol;
@@ -258,11 +270,27 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
@Override
protected void doDeactivate() throws Exception
{
+ CDOSessionProtocol sessionProtocol = getSessionProtocol();
super.doDeactivate();
- getCommitInfoManager().deactivate();
- getRevisionManager().deactivate();
- getBranchManager().deactivate();
+ InternalCDOCommitInfoManager commitInfoManager = getCommitInfoManager();
+ if (commitInfoManager.getCommitInfoLoader() == sessionProtocol)
+ {
+ commitInfoManager.deactivate();
+ }
+
+ InternalCDORevisionManager revisionManager = getRevisionManager();
+ if (revisionManager.getRevisionLoader() == sessionProtocol)
+ {
+ revisionManager.deactivate();
+ }
+
+ InternalCDOBranchManager branchManager = getBranchManager();
+ if (branchManager.getBranchLoader() == sessionProtocol)
+ {
+ branchManager.deactivate();
+ }
+
getPackageRegistry().deactivate();
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
index ac21fd8521..4663bf0f89 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
@@ -41,7 +41,6 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
import org.eclipse.emf.cdo.common.security.NoPermissionException;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
import org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo;
import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
@@ -50,6 +49,7 @@ import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.server.IStoreAccessor.QueryXRefsContext;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
+import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
@@ -793,8 +793,8 @@ public class TransactionCommitContext implements InternalCommitContext
}
};
- return new CDOCommitDataImpl(newPackageUnitsCollection, newObjectsCollection, changedObjectsCollection,
- detachedObjectsCollection);
+ return CDOCommitInfoUtil.createCommitData(newPackageUnitsCollection, newObjectsCollection,
+ changedObjectsCollection, detachedObjectsCollection);
}
protected void adjustForCommit()
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
index 8034f40aa9..0abf61fba3 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
@@ -228,10 +228,7 @@ public class RepositorySynchronizer extends PriorityQueueRunner implements Inter
if (remoteSession != null)
{
- remoteSession.removeListener(remoteSessionListener);
- remoteSession.getBranchManager().removeListener(remoteSessionListener);
- remoteSession.close();
- remoteSession = null;
+ closeRemoteSession();
}
super.doDeactivate();
@@ -266,18 +263,21 @@ public class RepositorySynchronizer extends PriorityQueueRunner implements Inter
if (remoteSession != null)
{
CDOSession element = remoteSession;
-
- remoteSession.getBranchManager().removeListener(remoteSessionListener);
- remoteSession.removeListener(remoteSessionListener);
- remoteSession.close();
- remoteSession = null;
-
+ closeRemoteSession();
fireEvent(new SingleDeltaContainerEvent<CDOSession>(this, element, IContainerDelta.Kind.REMOVED));
}
reconnect();
}
+ private void closeRemoteSession()
+ {
+ remoteSession.removeListener(remoteSessionListener);
+ remoteSession.getBranchManager().removeListener(remoteSessionListener);
+ remoteSession.close();
+ remoteSession = null;
+ }
+
private void reconnect()
{
clearQueue();
@@ -391,6 +391,7 @@ public class RepositorySynchronizer extends PriorityQueueRunner implements Inter
try
{
CDOSessionConfiguration masterConfiguration = remoteSessionConfigurationFactory.createSessionConfiguration();
+ masterConfiguration.setBranchManager(localRepository.getBranchManager());
masterConfiguration.setPassiveUpdateMode(PassiveUpdateMode.ADDITIONS);
masterConfiguration.setLockNotificationMode(LockNotificationMode.ALWAYS);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
index 45015bdc87..df2d3a242c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
@@ -38,7 +38,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.common.util.CDOException;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
+import org.eclipse.emf.cdo.internal.common.revision.AbstractCDORevisionCache;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.TransactionCommitContext;
import org.eclipse.emf.cdo.server.IStoreAccessor;
@@ -48,6 +48,7 @@ import org.eclipse.emf.cdo.server.StoreThreadLocal;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.commit.CDOChangeKindCache;
+import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
@@ -443,7 +444,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
List<CDORevisionKey> changedObjects = changeSet.getChangedObjects();
List<CDOIDAndVersion> detachedObjects = changeSet.getDetachedObjects();
- CDOCommitData data = new CDOCommitDataImpl(newPackages, newObjects, changedObjects, detachedObjects);
+ CDOCommitData data = CDOCommitInfoUtil.createCommitData(newPackages, newObjects, changedObjects, detachedObjects);
String comment = "<replicate raw commits>"; //$NON-NLS-1$
CDOCommitInfo commitInfo = manager.createCommitInfo(branch, toCommitTime, fromCommitTime, SYSTEM_USER_ID,
@@ -518,6 +519,13 @@ public abstract class SynchronizableRepository extends Repository.Default implem
{
super.doActivate();
+ InternalCDORevisionCache cache = getRevisionManager().getCache();
+ if (cache instanceof AbstractCDORevisionCache)
+ {
+ // Enable branch checks to ensure that no branches from the replicator session are used
+ ((AbstractCDORevisionCache)cache).setBranchManager(getBranchManager());
+ }
+
InternalStore store = getStore();
if (!store.isFirstStart())
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java
index 39d4c65ef9..1689f2bb1a 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorBase.java
@@ -31,11 +31,11 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.server.ITransaction;
+import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.CDOFeatureDeltaVisitorImpl;
@@ -317,7 +317,7 @@ public abstract class StoreAccessorBase extends Lifecycle implements IStoreAcces
storeAccessor.handleRevisions(null, null, timeStamp, true, new CDORevisionHandler.Filtered.Undetached(this));
List<CDOIDAndVersion> detachedObjects = detachCounter.getDetachedObjects();
- return new CDOCommitDataImpl(newPackageUnits, newObjects, changedObjects, detachedObjects);
+ return CDOCommitInfoUtil.createCommitData(newPackageUnits, newObjects, changedObjects, detachedObjects);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionConfiguration.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionConfiguration.java
index 8f3b3d082e..7a6c707a7e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionConfiguration.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionConfiguration.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests.util;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.id.CDOIDGenerator;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
@@ -125,4 +126,14 @@ public abstract class TestSessionConfiguration extends Notifier implements CDOSe
{
throw new UnsupportedOperationException();
}
+
+ public CDOBranchManager getBranchManager()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setBranchManager(CDOBranchManager branchManager)
+ {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java
index ee7e781101..f6c1c8dddd 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.session;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.id.CDOIDGenerator;
import org.eclipse.emf.cdo.view.CDOFetchRuleManager;
@@ -124,6 +125,16 @@ public interface CDOSessionConfiguration extends INotifier
public void setFetchRuleManager(CDOFetchRuleManager fetchRuleManager);
/**
+ * @since 4.2
+ */
+ public CDOBranchManager getBranchManager();
+
+ /**
+ * @since 4.2
+ */
+ public void setBranchManager(CDOBranchManager branchManager);
+
+ /**
* Returns the authenticator of this configuration, never <code>null</code>.
*
* @deprecated As of 4.2 use {@link #getCredentialsProvider()} and {@link #setCredentialsProvider(IPasswordCredentialsProvider)}, respectively
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 6ea78397bb..a08f36cec9 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
@@ -66,11 +66,11 @@ import org.eclipse.emf.cdo.eresource.CDOTextResource;
import org.eclipse.emf.cdo.eresource.EresourceFactory;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
import org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo;
import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl;
import org.eclipse.emf.cdo.session.CDORepositoryInfo;
import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
@@ -2738,7 +2738,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
CDOLockState[] locksOnNewObjectsArray = getLockStates(newObjects.keySet(), false);
locksOnNewObjects = Arrays.asList(locksOnNewObjectsArray);
- commitData = new CDOCommitDataImpl(newPackageUnits, revisions, deltas, detached);
+ commitData = CDOCommitInfoUtil.createCommitData(newPackageUnits, revisions, deltas, detached);
}
private <T> Map<CDOID, T> filterCommittables(Map<CDOID, T> map)

Back to the top