Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java107
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java120
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/ObjectLockedIndication.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/DelegatingCDORevisionManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java89
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java28
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java42
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java8
24 files changed, 208 insertions, 378 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 0187c87048..f58b739d1a 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
@@ -165,7 +165,7 @@ public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevi
}
}
- public boolean reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
+ public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
{
acquireAtomicRequestLock(revisedLock);
@@ -176,31 +176,13 @@ public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevi
{
if (timeStamp == CDORevision.UNSPECIFIED_DATE)
{
- // $$$ Why would this ever get called?
- // $$$ Used to be: cache.removeRevision(id, branchVersion);
- throw new RuntimeException("CDORevisionManagerImpl.reviseVersion called with CDORevision.UNSPECIFIED_DATE");
- }
-
- long oldTimestamp = revision.getRevised();
- long newTimestamp = timeStamp - 1;
- if (oldTimestamp != CDORevision.UNSPECIFIED_DATE)
- {
- if (oldTimestamp != newTimestamp)
- {
- // $$$ This can't be
- throw new IllegalStateException("CDORevisionManagerImpl.reviseVersion received conflicting revised values");
- }
-
- return false;
+ cache.removeRevision(id, branchVersion);
}
else
{
revision.setRevised(timeStamp - 1);
- return true;
}
}
-
- return false;
}
finally
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
index 5b6c11d56b..8cb4e6548a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
@@ -58,7 +58,7 @@ public interface InternalCDORevisionManager extends CDORevisionManager, CDORevis
public void reviseLatest(CDOID id, CDOBranch branch);
- public boolean reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp);
+ public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp);
/**
* @author Eike Stepper
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java
index 0069caa1af..9cc4659188 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AbstractSyncRevisionsRequest.java
@@ -13,9 +13,7 @@ package org.eclipse.emf.cdo.internal.net4j.protocol;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
@@ -37,7 +35,6 @@ import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import java.util.Map.Entry;
/**
* @author Simon McDuff
@@ -47,15 +44,15 @@ public abstract class AbstractSyncRevisionsRequest extends CDOClientRequest<Coll
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, AbstractSyncRevisionsRequest.class);
- protected Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables;
+ protected Map<CDOID, CDOIDAndVersion> idAndVersions;
protected int referenceChunk;
public AbstractSyncRevisionsRequest(CDOClientProtocol protocol, short signalID,
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables, int referenceChunk)
+ Map<CDOID, CDOIDAndVersion> idAndVersions, int referenceChunk)
{
super(protocol, signalID);
- this.refreshables = refreshables;
+ this.idAndVersions = idAndVersions;
this.referenceChunk = referenceChunk;
}
@@ -64,25 +61,14 @@ public abstract class AbstractSyncRevisionsRequest extends CDOClientRequest<Coll
{
if (TRACER.isEnabled())
{
- TRACER.trace("Synchronization " + refreshables.size() + " objects"); //$NON-NLS-1$ //$NON-NLS-2$
+ TRACER.trace("Synchronization " + idAndVersions.size() + " objects"); //$NON-NLS-1$ //$NON-NLS-2$
}
out.writeInt(referenceChunk);
- out.writeInt(refreshables.size());
- for (Entry<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshable : refreshables.entrySet())
+ out.writeInt(idAndVersions.size());
+ for (CDOIDAndVersion idAndVersion : idAndVersions.values())
{
- CDOIDAndBranch viewedIDandBranch = refreshable.getKey();
- CDOIDAndVersionAndBranch usedIDandVersionAndBranch = refreshable.getValue();
-
- // $$$ Remove this assertion
- if (!viewedIDandBranch.getID().equals(usedIDandVersionAndBranch.getID()))
- {
- throw new IllegalStateException("Logic error");
- }
- out.writeCDOID(viewedIDandBranch.getID());
- out.writeInt(viewedIDandBranch.getBranch().getID());
- out.writeInt(usedIDandVersionAndBranch.getBranchID());
- out.writeInt(usedIDandVersionAndBranch.getVersion());
+ out.writeCDOIDAndVersion(idAndVersion);
}
}
@@ -90,77 +76,66 @@ public abstract class AbstractSyncRevisionsRequest extends CDOClientRequest<Coll
protected Collection<CDORefreshContext> confirming(CDODataInput in) throws IOException
{
InternalCDORevisionManager revisionManager = getSession().getRevisionManager();
- Map<Long, CDORefreshContext> refreshContexts = new TreeMap<Long, CDORefreshContext>();
+ Map<CDOBranchPoint, CDORefreshContext> refreshContexts = new TreeMap<CDOBranchPoint, CDORefreshContext>();
- int dirtyCount = in.readInt();
- for (int i = 0; i < dirtyCount; i++)
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
{
- CDOIDAndBranch idAndBranch = in.readCDOIDAndBranch();
CDORevision revision = in.readCDORevision();
- long revisedTimestamp = in.readLong();
+ long oldRevised = in.readLong();
+ CDOBranchPoint branchPoint = CDOBranchUtil.createBranchPoint(revision.getBranch(), oldRevised);
- // $$$ Fix
- if (false)
+ CDOIDAndVersion idAndVersion = idAndVersions.get(revision.getID());
+ if (idAndVersion == null)
{
- // CDORevision revision = in.readCDORevision();
- long oldRevised = in.readLong();
- CDOBranchPoint branchPoint = CDOBranchUtil.createBranchPoint(revision.getBranch(), oldRevised);
-
- CDOIDAndVersionAndBranch idAndVersionAndBranch = refreshables.get(revision.getID());
- if (idAndVersionAndBranch == null)
- {
- throw new IllegalStateException(MessageFormat.format(
- Messages.getString("SyncRevisionsRequest.2"), revision.getID())); //$NON-NLS-1$
- }
-
- CDORefreshContext refreshContext = getRefreshContext(refreshContexts, branchPoint);
- Set<CDOIDAndVersion> dirtyObjects = refreshContext.getDirtyObjects();
- dirtyObjects.add(CDOIDUtil
- .createIDAndVersion(idAndVersionAndBranch.getID(), idAndVersionAndBranch.getVersion()));
-
- revisionManager.addRevision(revision);
+ throw new IllegalStateException(MessageFormat.format(
+ Messages.getString("SyncRevisionsRequest.2"), revision.getID())); //$NON-NLS-1$
}
+
+ Set<CDOIDAndVersion> dirtyObjects = getRefreshContext(refreshContexts, branchPoint).getDirtyObjects();
+ dirtyObjects.add(CDOIDUtil.createIDAndVersion(idAndVersion.getID(), idAndVersion.getVersion()));
+
+ revisionManager.addRevision(revision);
}
if (TRACER.isEnabled())
{
- TRACER.trace("Synchronization received " + dirtyCount + " dirty objects"); //$NON-NLS-1$ //$NON-NLS-2$
+ TRACER.trace("Synchronization received " + size + " dirty objects"); //$NON-NLS-1$ //$NON-NLS-2$
}
- int detachedCount = in.readInt();
- for (int i = 0; i < detachedCount; i++)
+ size = in.readInt();
+ for (int i = 0; i < size; i++)
{
- CDOIDAndBranch idAndBranch = in.readCDOIDAndBranch();
- long revisedTimestamp = in.readLong();
+ CDOID id = in.readCDOID();
+ CDOBranchPoint branchPoint = in.readCDOBranchPoint();
- // $$$ Fix
- if (false)
- {
- CDOID id = in.readCDOID();
- CDOBranchPoint branchPoint = in.readCDOBranchPoint();
-
- CDORefreshContext refreshContext = getRefreshContext(refreshContexts, branchPoint);
- Collection<CDOID> detachedObjects = refreshContext.getDetachedObjects();
- detachedObjects.add(id);
- }
+ Collection<CDOID> detachedObjects = getRefreshContext(refreshContexts, branchPoint).getDetachedObjects();
+ detachedObjects.add(id);
}
- if (TRACER.isEnabled())
+ for (CDORefreshContext refreshContext : refreshContexts.values())
{
- TRACER.trace("Synchronization received " + detachedCount + " detached objects"); //$NON-NLS-1$ //$NON-NLS-2$
+ Set<CDOIDAndVersion> dirtyObjects = refreshContext.getDirtyObjects();
+ Collection<CDOID> detachedObjects = refreshContext.getDetachedObjects();
+
+ dirtyObjects = Collections.unmodifiableSet(dirtyObjects);
+ detachedObjects = Collections.unmodifiableCollection(detachedObjects);
+
+ ((CDORefreshContextImpl)refreshContext).setDirtyObjects(dirtyObjects);
+ ((CDORefreshContextImpl)refreshContext).setDetachedObjects(detachedObjects);
}
return Collections.unmodifiableCollection(refreshContexts.values());
}
- private CDORefreshContext getRefreshContext(Map<Long, CDORefreshContext> refreshContexts, CDOBranchPoint branchPoint)
+ private CDORefreshContext getRefreshContext(Map<CDOBranchPoint, CDORefreshContext> refreshContexts,
+ CDOBranchPoint branchPoint)
{
- long timestamp = branchPoint.getTimeStamp();
- CDORefreshContext result = refreshContexts.get(timestamp);
+ CDORefreshContext result = refreshContexts.get(branchPoint);
if (result == null)
{
result = new CDORefreshContextImpl(branchPoint);
- refreshContexts.put(timestamp, result);
+ refreshContexts.put(branchPoint, result);
}
return result;
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
index 3e14fc8978..575435eff4 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
@@ -14,8 +14,7 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.util.TransportException;
@@ -84,10 +83,10 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO
return send(new OpenSessionRequest(this, repositoryName, passiveUpdateEnabled));
}
- public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOID, CDOIDAndVersion> idAndVersions, int initialChunkSize,
boolean passiveUpdateEnabled)
{
- send(new SetPassiveUpdateRequest(this, revisionData, initialChunkSize, passiveUpdateEnabled));
+ send(new SetPassiveUpdateRequest(this, idAndVersions, initialChunkSize, passiveUpdateEnabled));
}
public RepositoryTimeResult getRepositoryTime()
@@ -132,10 +131,9 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO
return send(new LoadRevisionByVersionRequest(this, id, branchVersion, referenceChunk));
}
- public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
- int initialChunkSize)
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersion> idAndVersions, int initialChunkSize)
{
- return send(new SyncRevisionsRequest(this, revisionData, initialChunkSize));
+ return send(new SyncRevisionsRequest(this, idAndVersions, initialChunkSize));
}
public void openView(int viewID, CDOBranchPoint branchPoint, boolean readOnly)
@@ -175,15 +173,15 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO
}
}
- public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
- LockType lockType) throws InterruptedException
+ public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersion> objects, long timeout, LockType lockType)
+ throws InterruptedException
{
InterruptedException interruptedException = null;
RuntimeException runtimeException = null;
try
{
- new LockObjectsRequest(this, view, revisionData, view.getSession().options().getCollectionLoadingPolicy()
+ new LockObjectsRequest(this, view, objects, view.getSession().options().getCollectionLoadingPolicy()
.getInitialChunkSize(), timeout, lockType).send();
}
catch (RemoteException ex)
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java
index 4740e633e4..d9418d3e76 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
@@ -36,10 +36,10 @@ public class LockObjectsRequest extends SyncRevisionsRequest
private long timeout;
- public LockObjectsRequest(CDOClientProtocol protocol, CDOView view,
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int referenceChunk, long timeout, LockType lockType)
+ public LockObjectsRequest(CDOClientProtocol protocol, CDOView view, Map<CDOID, CDOIDAndVersion> idAndVersions,
+ int referenceChunk, long timeout, LockType lockType)
{
- super(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, revisionData, referenceChunk);
+ super(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, idAndVersions, referenceChunk);
this.view = view;
this.timeout = timeout;
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java
index 51c37c49de..4463fcf936 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateRequest.java
@@ -11,8 +11,8 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
@@ -32,10 +32,10 @@ public class SetPassiveUpdateRequest extends SyncRevisionsRequest
private boolean passiveUpdateEnabled;
- public SetPassiveUpdateRequest(CDOClientProtocol protocol,
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int referenceChunk, boolean passiveUpdateEnabled)
+ public SetPassiveUpdateRequest(CDOClientProtocol protocol, Map<CDOID, CDOIDAndVersion> idAndVersions,
+ int referenceChunk, boolean passiveUpdateEnabled)
{
- super(protocol, CDOProtocolConstants.SIGNAL_PASSIVE_UPDATE, revisionData, referenceChunk);
+ super(protocol, CDOProtocolConstants.SIGNAL_PASSIVE_UPDATE, idAndVersions, referenceChunk);
this.passiveUpdateEnabled = passiveUpdateEnabled;
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java
index d51f7736cc..dc2f999b3a 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SyncRevisionsRequest.java
@@ -11,8 +11,8 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -29,16 +29,15 @@ import java.util.Map;
*/
public class SyncRevisionsRequest extends AbstractSyncRevisionsRequest
{
- public SyncRevisionsRequest(CDOClientProtocol protocol, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables,
- int referenceChunk)
+ public SyncRevisionsRequest(CDOClientProtocol protocol, Map<CDOID, CDOIDAndVersion> idAndVersions, int referenceChunk)
{
- this(protocol, CDOProtocolConstants.SIGNAL_SYNC_REVISIONS, refreshables, referenceChunk);
+ this(protocol, CDOProtocolConstants.SIGNAL_SYNC_REVISIONS, idAndVersions, referenceChunk);
}
- public SyncRevisionsRequest(CDOClientProtocol protocol, short signalID,
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> refreshables, int referenceChunk)
+ public SyncRevisionsRequest(CDOClientProtocol protocol, short signalID, Map<CDOID, CDOIDAndVersion> idAndVersions,
+ int referenceChunk)
{
- super(protocol, signalID, refreshables, referenceChunk);
+ super(protocol, signalID, idAndVersions, referenceChunk);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java
index cc6a2b1591..9d510e9c93 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AbstractSyncRevisionsIndication.java
@@ -11,21 +11,14 @@
*/
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.collection.Pair;
-import org.eclipse.net4j.util.collection.Triplet;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import java.io.IOException;
@@ -39,9 +32,9 @@ public abstract class AbstractSyncRevisionsIndication extends CDOReadIndication
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SyncRevisionsIndication.class);
- protected List<Triplet<CDOIDAndBranch, InternalCDORevision, Long>> dirtyData = new ArrayList<Triplet<CDOIDAndBranch, InternalCDORevision, Long>>();
+ protected List<Pair<InternalCDORevision, Long>> dirtyObjects = new ArrayList<Pair<InternalCDORevision, Long>>();
- protected List<Pair<CDOIDAndBranch, Long>> detachedData = new ArrayList<Pair<CDOIDAndBranch, Long>>();
+ protected List<Pair<CDOID, Long>> detachedObjects = new ArrayList<Pair<CDOID, Long>>();
protected int referenceChunk = CDORevision.UNCHUNKED;
@@ -58,10 +51,8 @@ public abstract class AbstractSyncRevisionsIndication extends CDOReadIndication
for (int i = 0; i < size; i++)
{
CDOID id = in.readCDOID();
- int viewBranchID = in.readInt();
- int revisionBranchID = in.readInt();
- int revisionVersion = in.readInt();
- process(id, viewBranchID, revisionBranchID, revisionVersion);
+ int version = in.readInt();
+ process(id, version);
}
}
@@ -70,107 +61,58 @@ public abstract class AbstractSyncRevisionsIndication extends CDOReadIndication
{
if (TRACER.isEnabled())
{
- TRACER.format("Sync found " + dirtyData.size() + " dirty objects"); //$NON-NLS-1$ //$NON-NLS-2$
+ TRACER.format("Sync found " + dirtyObjects.size() + " dirty objects"); //$NON-NLS-1$ //$NON-NLS-2$
}
- out.writeInt(dirtyData.size());
- for (Triplet<CDOIDAndBranch, InternalCDORevision, Long> triplet : dirtyData)
+ out.writeInt(dirtyObjects.size());
+ for (Pair<InternalCDORevision, Long> revisionAndOldRevised : dirtyObjects)
{
- out.writeCDOIDAndBranch(triplet.getElement1());
- out.writeCDORevision(triplet.getElement2(), referenceChunk);
- out.writeLong(triplet.getElement3());
+ out.writeCDORevision(revisionAndOldRevised.getElement1(), referenceChunk);
+ out.writeLong(revisionAndOldRevised.getElement2());
}
- out.writeInt(detachedData.size());
- for (Pair<CDOIDAndBranch, Long> pair : detachedData)
+ out.writeInt(detachedObjects.size());
+ for (Pair<CDOID, Long> idAndRevised : detachedObjects)
{
- out.writeCDOIDAndBranch(pair.getElement1());
- out.writeLong(pair.getElement2());
+ out.writeCDOID(idAndRevised.getElement1());
+ out.writeLong(idAndRevised.getElement2());
}
}
- protected abstract void process(CDOID id, int viewBranchID, int revisionBranchID, int revisionVersion);
-
- /**
- * @param id
- * Some object's CDOID
- * @param viewedBranchID
- * The ID of the branch that the client is viewing the object in
- * @param revisionBranchID
- * The ID of the branch of the revision that the client is using for this object
- * @param revisionVersion
- * The version of the revision that the client is using for this object
- */
- protected void updateObjectList(CDOID id, int viewedBranchID, int revisionBranchID, int revisionVersion)
- {
- // Construct the branchPoint that expresses what the client is *viewing*
- CDOBranch viewedBranch = getRepository().getBranchManager().getBranch(viewedBranchID);
- CDOBranchPoint branchPoint = CDOBranchUtil.createBranchPoint(viewedBranch, CDORevision.UNSPECIFIED_DATE);
-
- // Get the branch of the revision that the client is *using* to back the object
- CDOBranch revisionBranch = getRepository().getBranchManager().getBranch(revisionBranchID);
+ protected abstract void process(CDOID id, int version);
+ protected void udpateObjectList(CDOID id, int version)
+ {
try
{
- // Obtain the latest revision that can back the object that the client is viewing
- InternalCDORevision latestServerRev = (InternalCDORevision)getRepository().getRevisionManager().getRevision(id,
- branchPoint, referenceChunk, CDORevision.DEPTH_NONE, true);
-
- if (latestServerRev == null)
- {
- addDetachedData(id, viewedBranch, revisionBranch, revisionVersion);
- }
- else if (latestServerRev.getBranch().getID() != revisionBranchID
- || latestServerRev.getVersion() > revisionVersion)
+ // XXX Fix for branching!!
+ InternalCDORevision revision = (InternalCDORevision)getRepository().getRevisionManager().getRevision(id, null,
+ referenceChunk, CDORevision.DEPTH_NONE, true);
+ if (revision == null)
{
- addDirtyData(id, viewedBranch, latestServerRev, revisionBranch, revisionVersion);
+ detachedObjects.add(new Pair<CDOID, Long>(id, getTimestamp(id, version)));
}
- else if (latestServerRev.getBranch().getID() == revisionBranchID
- && latestServerRev.getVersion() < revisionVersion)
+ else if (revision.getVersion() > version || version == CDORevision.UNSPECIFIED_VERSION)
{
- // Same branch but server's latest version is older than client's version -- impossible!
- throw new IllegalStateException("The server's revision (" + latestServerRev + ") is on the same branch " //$NON-NLS-1$ //$NON-NLS-2$
- + "as the client's (" + revisionVersion + "), yet has a smaller version number."); //$NON-NLS-1$ //$NON-NLS-2$
+ dirtyObjects.add(new Pair<InternalCDORevision, Long>(revision, getTimestamp(id, version)));
}
- else
+ else if (revision.getVersion() < version)
{
- // $$$ Remove this else branch when all seems well
- // $$$ It's only an assertion to ensure we cover all cases.
- boolean _assert = latestServerRev.getBranch().getID() == revisionBranchID
- && latestServerRev.getVersion() == revisionVersion;
- if (!_assert)
- {
- throw new IllegalStateException("Server logic error");
- }
+ throw new IllegalStateException("The object " + revision.getID() + " has a lower version (" //$NON-NLS-1$ //$NON-NLS-2$
+ + revision.getVersion() + ") in the repository than the version (" + version + ") submitted."); //$NON-NLS-1$ //$NON-NLS-2$
}
}
catch (IllegalArgumentException revisionIsNullException)
{
- addDetachedData(id, viewedBranch, revisionBranch, revisionVersion);
+ detachedObjects.add(new Pair<CDOID, Long>(id, getTimestamp(id, version)));
}
}
- private void addDetachedData(CDOID id, CDOBranch viewedBranch, CDOBranch revisionBranch, int revisionVersion)
- {
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(id, viewedBranch);
- long revisedTimestamp = getRevisedTimestamp(id, revisionVersion, revisionBranch);
- detachedData.add(new Pair<CDOIDAndBranch, Long>(idAndBranch, revisedTimestamp));
- }
-
- private void addDirtyData(CDOID id, CDOBranch viewedBranch, InternalCDORevision latestServerRev,
- CDOBranch revisionBranch, int revisionVersion)
- {
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(id, viewedBranch);
- long revisedTimestamp = getRevisedTimestamp(id, revisionVersion, revisionBranch);
- dirtyData
- .add(new Triplet<CDOIDAndBranch, InternalCDORevision, Long>(idAndBranch, latestServerRev, revisedTimestamp));
- }
-
- protected long getRevisedTimestamp(CDOID id, int version, CDOBranch branch)
+ protected long getTimestamp(CDOID id, int version)
{
- CDOBranchVersion branchVersion = CDOBranchUtil.createBranchVersion(branch, version);
- CDORevision revision = getRepository().getRevisionManager().getRevisionByVersion(id, branchVersion,
- CDORevision.DEPTH_NONE, false);
+ // XXX Fix for branching!!
+ CDORevision revision = getRepository().getRevisionManager().getRevisionByVersion(id, null, CDORevision.DEPTH_NONE,
+ false);
if (revision != null)
{
return revision.getRevised() + 1;
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java
index ffa2ad383a..00261b3894 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java
@@ -12,8 +12,8 @@
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -33,9 +33,9 @@ public class LockObjectsIndication extends AbstractSyncRevisionsIndication
{
private LockType lockType;
- private List<CDOIDAndBranch> idAndBranches = new ArrayList<CDOIDAndBranch>();
+ private List<CDOID> ids = new ArrayList<CDOID>();
- private List<CDOIDAndVersionAndBranch> idAndVersionAndBranches = new ArrayList<CDOIDAndVersionAndBranch>();
+ private List<CDOIDAndVersion> idAndVersions = new ArrayList<CDOIDAndVersion>();
private IView view;
@@ -56,7 +56,7 @@ public class LockObjectsIndication extends AbstractSyncRevisionsIndication
try
{
view = getSession().getView(viewID);
- getRepository().getLockManager().lock(lockType, view, idAndBranches, timeout);
+ getRepository().getLockManager().lock(lockType, view, ids, timeout);
}
catch (InterruptedException ex)
{
@@ -67,29 +67,24 @@ public class LockObjectsIndication extends AbstractSyncRevisionsIndication
@Override
protected void responding(CDODataOutput out) throws IOException
{
- for (CDOIDAndVersionAndBranch idAndVersionAndBranch : idAndVersionAndBranches)
+ for (CDOIDAndVersion idAndVersion : idAndVersions)
{
- // $$$ Fix
- // updateObjectList(idAndVersionAndBranch);
+ udpateObjectList(idAndVersion.getID(), idAndVersion.getVersion());
}
- if (!detachedData.isEmpty())
+ if (!detachedObjects.isEmpty())
{
- getRepository().getLockManager().unlock(lockType, view, idAndBranches);
- throw new IllegalArgumentException(detachedData.size() + " objects are not persistent anymore"); //$NON-NLS-1$
+ getRepository().getLockManager().unlock(lockType, view, ids);
+ throw new IllegalArgumentException(detachedObjects.size() + " objects are not persistent anymore"); //$NON-NLS-1$
}
super.responding(out);
}
@Override
- protected void process(CDOID id, int viewBranchID, int revisionBranchID, int revisionVersion)
+ protected void process(CDOID id, int version)
{
- // $$$ Fix
- /*
- * CDOBranch branch = getRepository().getBranchManager().getBranch(idAndVersionAndBranch.getBranchID());
- * idAndBranches.add(CDOIDUtil.createIDAndBranch(idAndVersionAndBranch.getID(), branch));
- * idAndVersionAndBranches.add(idAndVersionAndBranch);
- */
+ ids.add(id);
+ idAndVersions.add(CDOIDUtil.createIDAndVersion(id, version));
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/ObjectLockedIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/ObjectLockedIndication.java
index 976ffdeaef..4ef2018e6d 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/ObjectLockedIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/ObjectLockedIndication.java
@@ -11,11 +11,12 @@
*/
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.spi.server.InternalLockManager;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
@@ -38,17 +39,18 @@ public class ObjectLockedIndication extends CDOReadIndication
{
int viewID = in.readInt();
IView view = getSession().getView(viewID);
+ InternalLockManager lockManager = getRepository().getLockManager();
LockType lockType = in.readCDOLockType();
- CDOIDAndBranch idAndBranch = in.readCDOIDAndBranch();
+ CDOID id = in.readCDOID();
boolean byOthers = in.readBoolean();
if (byOthers)
{
- isLocked = getRepository().getLockManager().hasLockByOthers(lockType, view, idAndBranch);
+ isLocked = lockManager.hasLockByOthers(lockType, view, id);
}
else
{
- isLocked = getRepository().getLockManager().hasLock(lockType, view, idAndBranch);
+ isLocked = lockManager.hasLock(lockType, view, id);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java
index 59863ab616..5ceb83952e 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRevisionsIndication.java
@@ -53,11 +53,11 @@ public class SyncRevisionsIndication extends AbstractSyncRevisionsIndication
}
@Override
- protected void process(CDOID id, int viewedBranchID, int revisionBranchID, int revisionVersion)
+ protected void process(CDOID id, int version)
{
- if (revisionVersion > 0) // $$$ What's this check for?
+ if (version > 0)
{
- updateObjectList(id, viewedBranchID, revisionBranchID, revisionVersion);
+ udpateObjectList(id, version);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java
index e4c9cfabc6..9dc6f67761 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java
@@ -11,7 +11,7 @@
*/
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
@@ -47,14 +47,14 @@ public class UnlockObjectsIndication extends CDOReadIndication
}
else
{
- List<CDOIDAndBranch> idAndBranches = new ArrayList<CDOIDAndBranch>(size);
+ List<CDOID> ids = new ArrayList<CDOID>(size);
for (int i = 0; i < size; i++)
{
- CDOIDAndBranch idAndBranch = in.readCDOIDAndBranch();
- idAndBranches.add(idAndBranch);
+ CDOID id = in.readCDOID();
+ ids.add(id);
}
- getRepository().getLockManager().unlock(lockType, view, idAndBranches);
+ getRepository().getLockManager().unlock(lockType, view, ids);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java
index d8b84f902c..41e5962364 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java
@@ -11,7 +11,7 @@
*/
package org.eclipse.emf.cdo.internal.server;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.ISessionManager;
import org.eclipse.emf.cdo.server.IView;
@@ -28,7 +28,7 @@ import org.eclipse.net4j.util.event.IListener;
* @author Simon McDuff
* @since 3.0
*/
-public class LockManager extends RWLockManager<CDOIDAndBranch, IView> implements InternalLockManager
+public class LockManager extends RWLockManager<CDOID, IView> implements InternalLockManager
{
private InternalRepository repository;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java
index 6058c0fd4c..e111103c95 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java
@@ -11,10 +11,8 @@
*/
package org.eclipse.emf.cdo.internal.server;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
@@ -80,7 +78,7 @@ public class TransactionCommitContextImpl implements InternalCommitContext
private CDOID[] detachedObjects;
- private List<CDOIDAndBranch> lockedObjects = new ArrayList<CDOIDAndBranch>();
+ private List<CDOID> lockedObjects = new ArrayList<CDOID>();
private List<InternalCDORevision> detachedRevisions = new ArrayList<InternalCDORevision>();;
@@ -411,17 +409,15 @@ public class TransactionCommitContextImpl implements InternalCommitContext
private void lockObjects() throws InterruptedException
{
- CDOBranch branch = getTransaction().getBranch();
-
lockedObjects.clear();
for (int i = 0; i < dirtyObjectDeltas.length; i++)
{
- lockedObjects.add(CDOIDUtil.createIDAndBranch(dirtyObjectDeltas[i].getID(), branch));
+ lockedObjects.add(dirtyObjectDeltas[i].getID());
}
for (int i = 0; i < detachedObjects.length; i++)
{
- lockedObjects.add(CDOIDUtil.createIDAndBranch(detachedObjects[i], branch));
+ lockedObjects.add(detachedObjects[i]);
}
try
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/DelegatingCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/DelegatingCDORevisionManager.java
index 7c09df8bad..a5c9a55a8a 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/DelegatingCDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/DelegatingCDORevisionManager.java
@@ -114,9 +114,9 @@ public abstract class DelegatingCDORevisionManager extends Lifecycle implements
getDelegate().reviseLatest(id, branch);
}
- public boolean reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
+ public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
{
- return getDelegate().reviseVersion(id, branchVersion, timeStamp);
+ getDelegate().reviseVersion(id, branchVersion, timeStamp);
}
protected abstract InternalCDORevisionManager getDelegate();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
index d274fb6a41..91ceead172 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
@@ -14,8 +14,7 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOAuthenticationResult;
@@ -126,7 +125,7 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
return result;
}
- public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOID, CDOIDAndVersion> idAndVersions, int initialChunkSize,
boolean passiveUpdateEnabled)
{
// serverSessionProtocol.getSession().setPassiveUpdateEnabled(passiveUpdateEnabled);
@@ -181,8 +180,7 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
}
}
- public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
- int initialChunkSize)
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersion> allRevisions, int initialChunkSize)
{
throw new UnsupportedOperationException();
}
@@ -273,8 +271,8 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
throw new UnsupportedOperationException();
}
- public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
- LockType lockType) throws InterruptedException
+ public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersion> objects, long timeout, LockType lockType)
+ throws InterruptedException
{
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java
index 92dc7d4390..2a8d3e853b 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java
@@ -10,7 +10,7 @@
*/
package org.eclipse.emf.cdo.spi.server;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.net4j.util.concurrent.IRWLockManager;
@@ -19,7 +19,7 @@ import org.eclipse.net4j.util.concurrent.IRWLockManager;
* @author Eike Stepper
* @since 3.0
*/
-public interface InternalLockManager extends IRWLockManager<CDOIDAndBranch, IView>
+public interface InternalLockManager extends IRWLockManager<CDOID, IView>
{
public InternalRepository getRepository();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java
index 5605d1ad96..e42adeeab9 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java
@@ -13,8 +13,6 @@ package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.CDOLock;
import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.session.CDOSession;
@@ -547,9 +545,7 @@ public class LockingManagerTest extends AbstractCDOTest
CDOObject cdoCompany = CDOUtil.getCDOObject(company);
cdoCompany.cdoReadLock().lock();
transaction.close();
-
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(cdoCompany.cdoID(), transaction.getBranch());
- assertEquals(false, repo.getLockManager().hasLock(LockType.READ, view, idAndBranch));
+ assertEquals(false, repo.getLockManager().hasLock(LockType.READ, view, cdoCompany.cdoID()));
}
public void testSessionClose() throws Exception
@@ -570,9 +566,7 @@ public class LockingManagerTest extends AbstractCDOTest
session.close();
sleep(100);
-
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(cdoCompany.cdoID(), transaction.getBranch());
- assertEquals(false, repo.getLockManager().hasLock(LockType.READ, view, idAndBranch));
+ assertEquals(false, repo.getLockManager().hasLock(LockType.READ, view, cdoCompany.cdoID()));
}
public void testBugzilla_270345() throws Exception
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java
index 577a5bb51a..8322bb46b9 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java
@@ -230,7 +230,6 @@ public class Bugzilla_273565_Test extends AbstractCDOTest
done[0] = false;
orderDetail.setPrice(2);
CDOSession session = openModel1Session();
- // session.options().setPassiveUpdateEnabled(false); // $$$ Remove this
CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.createResource("/test1");
resource.getContents().add(orderDetail);
@@ -243,7 +242,6 @@ public class Bugzilla_273565_Test extends AbstractCDOTest
try
{
CDOSession session = openModel1Session();
- // session.options().setPassiveUpdateEnabled(false); // $$$ Remove this
CDOTransaction transaction = session.openTransaction();
OrderDetail orderDetail2 = (OrderDetail)transaction.getObject(CDOUtil.getCDOObject(orderDetail).cdoID());
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index 87af174bb4..8dbdd717ec 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -20,9 +20,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
@@ -92,7 +90,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -480,14 +477,14 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
checkActive();
if (!options().isPassiveUpdateEnabled())
{
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = getAllRevisionData();
+ Map<CDOID, CDOIDAndVersion> allRevisions = getAllCDOIDAndVersion();
try
{
- if (!revisionData.isEmpty())
+ if (!allRevisions.isEmpty())
{
int initialChunkSize = options().getCollectionLoadingPolicy().getInitialChunkSize();
- return getSessionProtocol().syncRevisions(revisionData, initialChunkSize);
+ return getSessionProtocol().syncRevisions(allRevisions, initialChunkSize);
}
}
catch (Exception ex)
@@ -564,10 +561,9 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
* @since 2.0
*/
public void handleSyncResponse(CDOBranchPoint branchPoint, Collection<CDOPackageUnit> newPackageUnits,
- Set<CDOIDAndVersion> dirtyOIDandVersions, Collection<CDOID> detachedObjects)
+ Set<CDOIDAndVersion> dirtyOIDs, Collection<CDOID> detachedObjects)
{
- handleCommitNotification(branchPoint, newPackageUnits, dirtyOIDandVersions, detachedObjects, null, null, true,
- false);
+ handleCommitNotification(branchPoint, newPackageUnits, dirtyOIDs, detachedObjects, null, null, true, false);
}
public void handleBranchNotification(InternalCDOBranch branch)
@@ -579,15 +575,15 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
* @since 2.0
*/
public void handleCommitNotification(CDOBranchPoint branchPoint, Collection<CDOPackageUnit> newPackageUnits,
- Set<CDOIDAndVersion> dirtyOIDandVersions, Collection<CDOID> detachedOIDs, Collection<CDORevisionDelta> deltas,
+ Set<CDOIDAndVersion> dirtyOIDs, Collection<CDOID> detachedObjects, Collection<CDORevisionDelta> deltas,
InternalCDOView excludedView)
{
- handleCommitNotification(branchPoint, newPackageUnits, dirtyOIDandVersions, detachedOIDs, deltas, excludedView,
- options().isPassiveUpdateEnabled(), true);
+ handleCommitNotification(branchPoint, newPackageUnits, dirtyOIDs, detachedObjects, deltas, excludedView, options()
+ .isPassiveUpdateEnabled(), true);
}
private void handleCommitNotification(CDOBranchPoint branchPoint, final Collection<CDOPackageUnit> newPackageUnits,
- Set<CDOIDAndVersion> dirtyOIDandVersions, final Collection<CDOID> detachedOIDs,
+ Set<CDOIDAndVersion> dirtyOIDs, final Collection<CDOID> detachedObjects,
final Collection<CDORevisionDelta> deltas, InternalCDOView excludedView, final boolean passiveUpdate,
final boolean async)
{
@@ -600,13 +596,13 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
if (passiveUpdate)
{
- reviseRevisions(branchPoint, dirtyOIDandVersions, detachedOIDs, excludedView);
+ reviseRevisions(branchPoint, dirtyOIDs, detachedObjects, excludedView);
}
- final Set<CDOIDAndVersion> finalDirtyOIDandVersions = Collections.unmodifiableSet(dirtyOIDandVersions);
- final Collection<CDOID> finalDetachedOIDs = Collections.unmodifiableCollection(detachedOIDs);
+ final Set<CDOIDAndVersion> finalDirtyOIDs = Collections.unmodifiableSet(dirtyOIDs);
+ final Collection<CDOID> finalDetachedObjects = Collections.unmodifiableCollection(detachedObjects);
final boolean skipChangeSubscription = (deltas == null || deltas.size() <= 0)
- && (detachedOIDs == null || detachedOIDs.size() <= 0);
+ && (detachedObjects == null || detachedObjects.size() <= 0);
for (final InternalCDOView view : getViews())
{
@@ -621,12 +617,12 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
Set<CDOObject> conflicts = null;
if (passiveUpdate)
{
- conflicts = view.handleInvalidation(timeStamp, finalDirtyOIDandVersions, finalDetachedOIDs);
+ conflicts = view.handleInvalidation(timeStamp, finalDirtyOIDs, finalDetachedObjects);
}
if (!skipChangeSubscription)
{
- view.handleChangeSubscription(deltas, detachedOIDs);
+ view.handleChangeSubscription(deltas, detachedObjects);
}
if (conflicts != null)
@@ -700,7 +696,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
setLastUpdateTime(timeStamp);
- fireInvalidationEvent(branchPoint, newPackageUnits, dirtyOIDandVersions, detachedOIDs, excludedView);
+ fireInvalidationEvent(branchPoint, newPackageUnits, dirtyOIDs, detachedObjects, excludedView);
}
public void reviseRevisions(CDOBranchPoint branchPoint, Set<CDOIDAndVersion> dirtyOIDs,
@@ -712,23 +708,12 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
if (excludedView == null || timeStamp == CDORevision.UNSPECIFIED_DATE)
{
- List<CDOIDAndVersion> notRevised = new LinkedList<CDOIDAndVersion>();
for (CDOIDAndVersion dirtyOID : dirtyOIDs)
{
CDOID id = dirtyOID.getID();
int version = dirtyOID.getVersion();
revisionManager.reviseVersion(id, branch.getVersion(version), timeStamp);
- // $$$ Why doesn't the following work?
- // boolean revised = revisionManager.reviseVersion(id, branch.getVersion(version), timeStamp);
- // if (!revised)
- // {
- // notRevised.add(dirtyOID);
- // }
}
-
- // notRevised holds revisions that we thought had to be revised,
- // but actually didn't need revising
- dirtyOIDs.removeAll(notRevised);
}
for (CDOID id : detachedObjects)
@@ -879,31 +864,24 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
super.doDeactivate();
}
- private Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> getAllRevisionData()
+ private Map<CDOID, CDOIDAndVersion> getAllCDOIDAndVersion()
{
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = new HashMap<CDOIDAndBranch, CDOIDAndVersionAndBranch>();
- // Map<CDOID, CDOIDAndVersionAndBranch> uniqueObjects = new HashMap<CDOID, CDOIDAndVersionAndBranch>();
+ Map<CDOID, CDOIDAndVersion> uniqueObjects = new HashMap<CDOID, CDOIDAndVersion>();
for (InternalCDOView view : getViews())
{
- view.getCDOIDAndVersionAndBranch(revisionData, Arrays.asList(view.getObjectsArray()));
+ view.getCDOIDAndVersion(uniqueObjects, Arrays.asList(view.getObjectsArray()));
}
- // Need to add current revisions from revisionManager that aren't in view
+ // Need to add Revision from revisionManager since we do not have all objects in view.
for (CDORevision revision : getRevisionManager().getCache().getCurrentRevisions())
{
- CDOID id = revision.getID();
- int revisionBranchID = revision.getBranch().getID();
- int revisionVersion = revision.getVersion();
- CDOIDAndVersionAndBranch ivb = CDOIDUtil.createIDAndVersionAndBranch(id, revisionVersion, revisionBranchID);
-
- if (!revisionData.containsValue(ivb))
+ if (!uniqueObjects.containsKey(revision.getID()))
{
- // $$$ Fix; how do we deal with these "unviewed" current revisions
- // revisionData.put(???, ivb);
+ uniqueObjects.put(revision.getID(), CDOIDUtil.createIDAndVersion(revision.getID(), revision.getVersion()));
}
}
- return revisionData;
+ return uniqueObjects;
}
public static boolean isInvalidationRunnerActive()
@@ -968,11 +946,11 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
this.passiveUpdateEnabled = passiveUpdateEnabled;
// Need to refresh if we change state
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = getAllRevisionData();
- if (!revisionData.isEmpty())
+ Map<CDOID, CDOIDAndVersion> allRevisions = getAllCDOIDAndVersion();
+ if (!allRevisions.isEmpty())
{
int initialChunkSize = collectionLoadingPolicy.getInitialChunkSize();
- getSessionProtocol().setPassiveUpdate(revisionData, initialChunkSize, passiveUpdateEnabled);
+ getSessionProtocol().setPassiveUpdate(allRevisions, initialChunkSize, passiveUpdateEnabled);
}
IListener[] listeners = getListeners();
@@ -1465,15 +1443,15 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
- LockType lockType) throws InterruptedException
+ public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersion> objects, long timeout, LockType lockType)
+ throws InterruptedException
{
int attempt = 0;
for (;;)
{
try
{
- delegate.lockObjects(view, revisionData, timeout, lockType);
+ delegate.lockObjects(view, objects, timeout, lockType);
return;
}
catch (Exception ex)
@@ -1500,7 +1478,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOID, CDOIDAndVersion> idAndVersions, int initialChunkSize,
boolean passiveUpdateEnabled)
{
int attempt = 0;
@@ -1508,7 +1486,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
try
{
- delegate.setPassiveUpdate(revisionData, initialChunkSize, passiveUpdateEnabled);
+ delegate.setPassiveUpdate(idAndVersions, initialChunkSize, passiveUpdateEnabled);
return;
}
catch (Exception ex)
@@ -1518,15 +1496,14 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
- int initialChunkSize)
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersion> allRevisions, int initialChunkSize)
{
int attempt = 0;
for (;;)
{
try
{
- return delegate.syncRevisions(revisionData, initialChunkSize);
+ return delegate.syncRevisions(allRevisions, initialChunkSize);
}
catch (Exception ex)
{
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 e88d26fbd8..a0270a74e8 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
@@ -20,9 +20,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.commit.CDOCommit;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
@@ -342,28 +340,26 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
@Override
- public void getCDOIDAndVersionAndBranch(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
- Collection<? extends CDOObject> cdoObjects)
+ public void getCDOIDAndVersion(Map<CDOID, CDOIDAndVersion> uniqueObjects, Collection<? extends CDOObject> cdoObjects)
{
Map<CDOID, CDORevisionDelta> deltaMap = getRevisionDeltas();
for (CDOObject cdoObject : cdoObjects)
{
CDORevision cdoRevision = CDOStateMachine.INSTANCE.readNoLoad((InternalCDOObject)cdoObject);
CDOID cdoId = cdoObject.cdoID();
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(cdoId, getBranch());
- if (cdoRevision != null && !cdoId.isTemporary() && !revisionData.containsKey(idAndBranch))
+ if (cdoRevision != null && !cdoId.isTemporary() && !uniqueObjects.containsKey(cdoId))
{
- int revisionVersion = cdoRevision.getVersion();
+ int version = cdoRevision.getVersion();
if (deltaMap != null)
{
CDORevisionDelta delta = deltaMap.get(cdoId);
if (delta != null)
{
- revisionVersion = delta.getVersion();
+ version = delta.getVersion();
}
}
- int revisionBranchID = cdoRevision.getBranch().getID();
- revisionData.put(idAndBranch, CDOIDUtil.createIDAndVersionAndBranch(cdoId, revisionVersion, revisionBranchID));
+
+ uniqueObjects.put(cdoId, CDOIDUtil.createIDAndVersion(cdoId, version));
}
}
}
@@ -1203,7 +1199,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
/**
* TODO Simon: Should this method go to CDOSavePointImpl?
*/
- @SuppressWarnings( { "rawtypes", "unchecked" })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
private void registerNew(Map map, InternalCDOObject object)
{
Object old = map.put(object.cdoID(), object);
@@ -1743,15 +1739,15 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
Map<CDOID, CDOObject> dirtyObjects = getDirtyObjects();
- Set<CDOIDAndVersion> dirtyIDandVersions = new HashSet<CDOIDAndVersion>();
+ Set<CDOIDAndVersion> dirtyIDs = new HashSet<CDOIDAndVersion>();
for (CDOObject dirtyObject : dirtyObjects.values())
{
CDORevision revision = dirtyObject.cdoRevision();
CDOIDAndVersion dirtyID = CDOIDUtil.createIDAndVersion(revision.getID(), revision.getVersion() - 1);
- dirtyIDandVersions.add(dirtyID);
+ dirtyIDs.add(dirtyID);
}
- if (!dirtyIDandVersions.isEmpty() || !getDetachedObjects().isEmpty())
+ if (!dirtyIDs.isEmpty() || !getDetachedObjects().isEmpty())
{
Set<CDOID> detachedIDs = new HashSet<CDOID>(getDetachedObjects().keySet());
Collection<CDORevisionDelta> deltasCopy = new ArrayList<CDORevisionDelta>(deltas);
@@ -1763,8 +1759,8 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
((InternalCDORevisionDelta)dirtyObjectDelta).adjustReferences(result.getReferenceAdjuster());
}
- session.handleCommitNotification(getBranch().getPoint(result.getTimeStamp()), newPackageUnits,
- dirtyIDandVersions, detachedIDs, deltasCopy, getTransaction());
+ session.handleCommitNotification(getBranch().getPoint(result.getTimeStamp()), newPackageUnits, dirtyIDs,
+ detachedIDs, deltasCopy, getTransaction());
}
else
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
index 7f8941724a..76b4e8e761 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
@@ -18,9 +18,7 @@ import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOModelUtil;
@@ -397,24 +395,19 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
throws InterruptedException
{
checkActive();
- Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData = new HashMap<CDOIDAndBranch, CDOIDAndVersionAndBranch>();
- getCDOIDAndVersionAndBranch(revisionData, objects);
+ Map<CDOID, CDOIDAndVersion> uniqueObjects = new HashMap<CDOID, CDOIDAndVersion>();
+ getCDOIDAndVersion(uniqueObjects, objects);
for (CDOObject object : objects)
{
- CDOBranch viewedBranch = getBranch();
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(object.cdoID(), viewedBranch);
-
- CDOIDAndVersionAndBranch idAndVersionAndBranch = revisionData.get(object.cdoID());
- if (idAndVersionAndBranch == null)
+ CDOIDAndVersion idAndVersion = uniqueObjects.get(object.cdoID());
+ if (idAndVersion == null)
{
- CDOID cdoID = object.cdoID();
- int version = CDORevision.UNSPECIFIED_VERSION;
- CDOIDAndVersionAndBranch ivb = CDOIDUtil.createIDAndVersionAndBranch(cdoID, version, getBranch().getID());
- revisionData.put(idAndBranch, ivb);
+ uniqueObjects
+ .put(object.cdoID(), CDOIDUtil.createIDAndVersion(object.cdoID(), CDORevision.UNSPECIFIED_VERSION));
}
}
- session.getSessionProtocol().lockObjects(this, revisionData, timeout, lockType);
+ session.getSessionProtocol().lockObjects(this, uniqueObjects, timeout, lockType);
}
/**
@@ -1298,12 +1291,12 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
* @param timeStamp
* The time stamp of the server transaction if this event was sent as a result of a successfully committed
* transaction or <code>LOCAL_ROLLBACK</code> if this event was sent due to a local rollback.
- * @param dirtyOIDandVersions
+ * @param dirtyOIDs
* A set of the object IDs to be invalidated. <b>Implementation note:</b> This implementation expects the
* dirtyOIDs set to be unmodifiable. It does not wrap the set (again).
* @since 2.0
*/
- public Set<CDOObject> handleInvalidation(long timeStamp, Set<CDOIDAndVersion> dirtyOIDandVersions,
+ public Set<CDOObject> handleInvalidation(long timeStamp, Set<CDOIDAndVersion> dirtyOIDs,
Collection<CDOID> detachedOIDs)
{
Set<CDOObject> conflicts = null;
@@ -1313,8 +1306,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
try
{
- conflicts = handleInvalidationWithoutNotification(dirtyOIDandVersions, detachedOIDs, dirtyObjects,
- detachedObjects);
+ conflicts = handleInvalidationWithoutNotification(dirtyOIDs, detachedOIDs, dirtyObjects, detachedObjects);
}
finally
{
@@ -1607,22 +1599,16 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
return getResourceSet();
}
- public void getCDOIDAndVersionAndBranch(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
- Collection<? extends CDOObject> cdoObjects)
+ public void getCDOIDAndVersion(Map<CDOID, CDOIDAndVersion> uniqueObjects, Collection<? extends CDOObject> cdoObjects)
{
for (CDOObject internalCDOObject : cdoObjects)
{
CDORevision cdoRevision = CDOStateMachine.INSTANCE.readNoLoad((InternalCDOObject)internalCDOObject);
CDOID cdoId = internalCDOObject.cdoID();
-
- CDOBranch viewedBranch = getBranch();
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(cdoId, viewedBranch);
-
- if (cdoRevision != null && !revisionData.containsKey(idAndBranch))
+ if (cdoRevision != null && !uniqueObjects.containsKey(cdoId))
{
- int revisionVersion = cdoRevision.getVersion();
- int revisionBranchID = cdoRevision.getBranch().getID();
- revisionData.put(idAndBranch, CDOIDUtil.createIDAndVersionAndBranch(cdoId, revisionVersion, revisionBranchID));
+ int version = cdoRevision.getVersion();
+ uniqueObjects.put(cdoId, CDOIDUtil.createIDAndVersion(cdoId, version));
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
index 20df844e4d..0728f39d07 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
@@ -13,8 +13,7 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.protocol.CDOProtocol;
@@ -52,7 +51,7 @@ import java.util.Set;
*/
public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLoader, RevisionLoader
{
- public void setPassiveUpdate(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, int initialChunkSize,
+ public void setPassiveUpdate(Map<CDOID, CDOIDAndVersion> idAndVersions, int initialChunkSize,
boolean passiveUpdateEnabled);
public RepositoryTimeResult getRepositoryTime();
@@ -72,8 +71,7 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo
public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
int fromIndex, int toIndex);
- public Collection<CDORefreshContext> syncRevisions(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
- int initialChunkSize);
+ public Collection<CDORefreshContext> syncRevisions(Map<CDOID, CDOIDAndVersion> allRevisions, int initialChunkSize);
/**
* @since 3.0
@@ -99,8 +97,8 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo
/**
* @since 3.0
*/
- public void lockObjects(CDOView view, Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData, long timeout,
- LockType lockType) throws InterruptedException;
+ public void lockObjects(CDOView view, Map<CDOID, CDOIDAndVersion> objects, long timeout, LockType lockType)
+ throws InterruptedException;
/**
* @since 3.0
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
index 4aeca5aed5..36b84dfb68 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
@@ -13,9 +13,7 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.id.CDOIDAndVersionAndBranch;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
@@ -76,11 +74,7 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
public Set<CDOObject> handleInvalidationWithoutNotification(Set<CDOIDAndVersion> dirtyOIDs,
Collection<CDOID> detachedOIDs, Set<InternalCDOObject> dirtyObjects, Set<InternalCDOObject> detachedObjects);
- /**
- * @since 3.0
- */
- public void getCDOIDAndVersionAndBranch(Map<CDOIDAndBranch, CDOIDAndVersionAndBranch> revisionData,
- Collection<? extends CDOObject> cdoObjects);
+ public void getCDOIDAndVersion(Map<CDOID, CDOIDAndVersion> uniqueObjects, Collection<? extends CDOObject> cdoObjects);
public void handleChangeSubscription(Collection<CDORevisionDelta> deltas, Collection<CDOID> detachedObjects);

Back to the top