Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-09-14 20:10:24 +0000
committerEike Stepper2016-09-14 20:10:24 +0000
commitab5a2daa464d6fcfac41c7cf98ff43c6ab203ab7 (patch)
tree2d6038dd7a8a0fec09809324593410c5f0ba5450
parent33baff0209883339e4b3f013db3e3631193bd184 (diff)
downloadcdo-ab5a2daa464d6fcfac41c7cf98ff43c6ab203ab7.tar.gz
cdo-ab5a2daa464d6fcfac41c7cf98ff43c6ab203ab7.tar.xz
cdo-ab5a2daa464d6fcfac41c7cf98ff43c6ab203ab7.zip
Apply optimizations with greatest potential
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/.settings/.api_filters7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java64
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java112
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUserSavepointImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java125
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java207
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java67
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java15
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java15
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java10
12 files changed, 364 insertions, 281 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
index bae348f0f4..ed651fff5d 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
@@ -249,6 +249,11 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd
throw new UnsupportedOperationException();
}
+ public CDOFeatureAnalyzer getFeatureAnalyzerUnsynced()
+ {
+ return options().getFeatureAnalyzer();
+ }
+
@SuppressWarnings("deprecation")
public CDOFeatureAnalyzer getFeatureAnalyzer()
{
diff --git a/plugins/org.eclipse.emf.cdo/.settings/.api_filters b/plugins/org.eclipse.emf.cdo/.settings/.api_filters
index 8b3ea3cdab..9addf4e9de 100644
--- a/plugins/org.eclipse.emf.cdo/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo/.settings/.api_filters
@@ -644,13 +644,6 @@
</filter>
</resource>
<resource path="src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java" type="org.eclipse.emf.internal.cdo.view.AbstractCDOView">
- <filter id="574660632">
- <message_arguments>
- <message_argument value="InternalCDOView"/>
- <message_argument value="CDOCommonView"/>
- <message_argument value="AbstractCDOView"/>
- </message_arguments>
- </filter>
<filter id="574668824">
<message_arguments>
<message_argument value="InternalCDOView"/>
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index 466771a7c1..8c0c29999b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -441,7 +441,8 @@ public class CDOObjectImpl extends MinimalEStoreEObjectImpl implements InternalC
int eContainerFeatureID = eBasicContainerFeatureID();
InternalCDORevision revision = cdoRevision();
- revision.setContainerID(eContainer == null ? CDOID.NULL : viewAndState.view.convertObjectToID(eContainer, true));
+ revision.setContainerID(
+ eContainer == null ? CDOID.NULL : viewAndState.view.convertObjectToIDUnsynced(eContainer, true));
revision.setContainingFeatureID(eContainerFeatureID);
Resource directResource = eDirectResource();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
index 31b60e514a..ad3587ff2a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
@@ -122,6 +122,12 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
}
@Override
+ public InternalCDOSavepoint getFirstSavePointUnsynced()
+ {
+ return (InternalCDOSavepoint)super.getFirstSavePointUnsynced();
+ }
+
+ @Override
public InternalCDOSavepoint getFirstSavePoint()
{
synchronized (transaction.getViewMonitor())
@@ -130,7 +136,7 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- return (InternalCDOSavepoint)super.getFirstSavePoint();
+ return getFirstSavePointUnsynced();
}
finally
{
@@ -140,6 +146,12 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
}
@Override
+ public InternalCDOSavepoint getPreviousSavepointUnsynced()
+ {
+ return (InternalCDOSavepoint)super.getPreviousSavepointUnsynced();
+ }
+
+ @Override
public InternalCDOSavepoint getPreviousSavepoint()
{
synchronized (transaction.getViewMonitor())
@@ -148,7 +160,7 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- return (InternalCDOSavepoint)super.getPreviousSavepoint();
+ return getPreviousSavepointUnsynced();
}
finally
{
@@ -158,6 +170,12 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
}
@Override
+ public InternalCDOSavepoint getNextSavepointUnsynced()
+ {
+ return (InternalCDOSavepoint)super.getNextSavepointUnsynced();
+ }
+
+ @Override
public InternalCDOSavepoint getNextSavepoint()
{
synchronized (transaction.getViewMonitor())
@@ -166,7 +184,7 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- return (InternalCDOSavepoint)super.getNextSavepoint();
+ return getNextSavepointUnsynced();
}
finally
{
@@ -413,13 +431,14 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- if (getPreviousSavepoint() == null)
+ if (getPreviousSavepointUnsynced() == null)
{
return Collections.unmodifiableMap(getDirtyObjects());
}
MultiMap.ListBased<CDOID, CDOObject> dirtyObjects = new MultiMap.ListBased<CDOID, CDOObject>();
- for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint.getPreviousSavepoint())
+ for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint
+ .getPreviousSavepointUnsynced())
{
dirtyObjects.getDelegates().add(savepoint.getDirtyObjects());
}
@@ -444,14 +463,14 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- if (getPreviousSavepoint() == null)
+ if (getPreviousSavepointUnsynced() == null)
{
return Collections.unmodifiableMap(getNewObjects());
}
Map<CDOID, CDOObject> newObjects = CDOIDUtil.createMap();
- for (InternalCDOSavepoint savepoint = getFirstSavePoint(); savepoint != null; savepoint = savepoint
- .getNextSavepoint())
+ for (InternalCDOSavepoint savepoint = getFirstSavePointUnsynced(); savepoint != null; savepoint = savepoint
+ .getNextSavepointUnsynced())
{
newObjects.putAll(savepoint.getNewObjects());
for (CDOID removedID : savepoint.getDetachedObjects().keySet())
@@ -480,13 +499,14 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- if (getPreviousSavepoint() == null)
+ if (getPreviousSavepointUnsynced() == null)
{
return Collections.unmodifiableMap(getBaseNewObjects());
}
MultiMap.ListBased<CDOID, CDORevision> newObjects = new MultiMap.ListBased<CDOID, CDORevision>();
- for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint.getPreviousSavepoint())
+ for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint
+ .getPreviousSavepointUnsynced())
{
newObjects.getDelegates().add(savepoint.getBaseNewObjects());
}
@@ -511,15 +531,15 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- if (getPreviousSavepoint() == null)
+ if (getPreviousSavepointUnsynced() == null)
{
return Collections.unmodifiableMap(getRevisionDeltas2());
}
// We need to combined the result for all delta in different Savepoint
Map<CDOID, CDORevisionDelta> allRevisionDeltas = CDOIDUtil.createMap();
- for (InternalCDOSavepoint savepoint = getFirstSavePoint(); savepoint != null; savepoint = savepoint
- .getNextSavepoint())
+ for (InternalCDOSavepoint savepoint = getFirstSavePointUnsynced(); savepoint != null; savepoint = savepoint
+ .getNextSavepointUnsynced())
{
for (CDORevisionDelta revisionDelta : savepoint.getRevisionDeltas2().values())
{
@@ -569,14 +589,14 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- if (getPreviousSavepoint() == null && getReattachedObjects().isEmpty())
+ if (getPreviousSavepointUnsynced() == null && getReattachedObjects().isEmpty())
{
return Collections.unmodifiableMap(getDetachedObjects());
}
Map<CDOID, CDOObject> detachedObjects = CDOIDUtil.createMap();
- for (InternalCDOSavepoint savepoint = getFirstSavePoint(); savepoint != null; savepoint = savepoint
- .getNextSavepoint())
+ for (InternalCDOSavepoint savepoint = getFirstSavePointUnsynced(); savepoint != null; savepoint = savepoint
+ .getNextSavepointUnsynced())
{
for (Entry<CDOID, CDOObject> entry : savepoint.getDetachedObjects().entrySet())
{
@@ -617,7 +637,8 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint.getPreviousSavepoint())
+ for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint
+ .getPreviousSavepointUnsynced())
{
if (savepoint.getNewObjects().containsKey(id))
{
@@ -646,7 +667,8 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
// boolean wasNew = false;
// synchronized (transaction) // TODO synchronized -> transaction.getViewLock().lock()
// {
- // for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint.getPreviousSavepoint())
+ // for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint =
+ // savepoint.getPreviousSavepointUnsynced())
// {
// if (savepoint.getNewObjects().containsKey(id))
// {
@@ -677,7 +699,8 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint.getPreviousSavepoint())
+ for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint
+ .getPreviousSavepointUnsynced())
{
Map<CDOID, CDOObject> reattachedObjects = savepoint.getReattachedObjects();
if (!reattachedObjects.isEmpty())
@@ -717,7 +740,8 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
try
{
- for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint.getPreviousSavepoint())
+ for (InternalCDOSavepoint savepoint = this; savepoint != null; savepoint = savepoint
+ .getPreviousSavepointUnsynced())
{
Map<CDOID, CDOObject> dirtyObjects = savepoint.getDirtyObjects();
if (!dirtyObjects.isEmpty())
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 c6719a057a..5ed624c18c 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
@@ -1477,36 +1477,20 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return null;
}
- /**
- * @since 2.0
- */
@Override
- public InternalCDOObject getObject(CDOID id, boolean loadOnDemand)
+ protected InternalCDOObject getObjectUnsynced(CDOID id, boolean loadOnDemand)
{
- checkActive();
- synchronized (getViewMonitor())
+ if (CDOIDUtil.isNull(id))
{
- lockView();
-
- try
- {
- if (CDOIDUtil.isNull(id))
- {
- return null;
- }
-
- if (isObjectNew(id) && isObjectDetached(id))
- {
- throw new ObjectNotFoundException(id, this);
- }
+ return null;
+ }
- return super.getObject(id, loadOnDemand);
- }
- finally
- {
- unlockView();
- }
+ if (isObjectNew(id) && isObjectDetached(id))
+ {
+ throw new ObjectNotFoundException(id, this);
}
+
+ return super.getObjectUnsynced(id, loadOnDemand);
}
@Override
@@ -2314,19 +2298,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
*/
public void registerFeatureDelta(InternalCDOObject object, CDOFeatureDelta featureDelta)
{
- synchronized (getViewMonitor())
- {
- lockView();
-
- try
- {
- registerFeatureDelta(object, featureDelta, null);
- }
- finally
- {
- unlockView();
- }
- }
+ registerFeatureDelta(object, featureDelta, null);
}
public void registerFeatureDelta(InternalCDOObject object, CDOFeatureDelta featureDelta,
@@ -2344,7 +2316,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
if (object.cdoState() == CDOState.NEW)
{
// Register Delta for new objects only if objectA doesn't belong to this savepoint
- if (getLastSavepoint().getPreviousSavepoint() == null || featureDelta == null)
+ if (getLastSavepoint().getPreviousSavepointUnsynced() == null || featureDelta == null)
{
needToSaveFeatureDelta = false;
}
@@ -2977,49 +2949,37 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
@Override
- protected CDOID getID(InternalCDOObject object, boolean onlyPersistedID)
+ protected CDOID getIDUnsynced(InternalCDOObject object, boolean onlyPersistedID)
{
- synchronized (getViewMonitor())
+ CDOID id = super.getIDUnsynced(object, onlyPersistedID);
+ if (id != null)
{
- lockView();
-
- try
- {
- CDOID id = super.getID(object, onlyPersistedID);
- if (id != null)
- {
- return id;
- }
-
- // Don't perform the trickery that follows later in this method, if we are being called
- // indirectly through provideCDOID. This occurs when deltas or revisions are
- // being written out to a stream; in which case null must be returned (for transients) so that
- // the caller will detect a dangling reference
- if (providingCDOID.get() == Boolean.TRUE)
- {
- return null;
- }
+ return id;
+ }
- // The super implementation returns null for a transient (unattached) object;
- // but in a transaction, a transient object may have been attached previously.
- // So we consult the cleanRevisions if that's the case.
- CDORevisionKey revisionKey = cleanRevisions.get(object);
- if (revisionKey != null)
- {
- CDOID revisionID = revisionKey.getID();
- if (lastSavepoint.getDetachedObject(revisionID) != null)
- {
- return revisionID;
- }
- }
+ // Don't perform the trickery that follows later in this method, if we are being called
+ // indirectly through provideCDOID. This occurs when deltas or revisions are
+ // being written out to a stream; in which case null must be returned (for transients) so that
+ // the caller will detect a dangling reference
+ if (providingCDOID.get() == Boolean.TRUE)
+ {
+ return null;
+ }
- return null;
- }
- finally
+ // The super implementation returns null for a transient (unattached) object;
+ // but in a transaction, a transient object may have been attached previously.
+ // So we consult the cleanRevisions if that's the case.
+ CDORevisionKey revisionKey = cleanRevisions.get(object);
+ if (revisionKey != null)
+ {
+ CDOID revisionID = revisionKey.getID();
+ if (lastSavepoint.getDetachedObject(revisionID) != null)
{
- unlockView();
+ return revisionID;
}
}
+
+ return null;
}
@Override
@@ -3034,7 +2994,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
try
{
providingCDOID.set(Boolean.TRUE);
- return super.provideCDOID(idOrObject);
+ return provideCDOIDUnsynced(idOrObject);
}
finally
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUserSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUserSavepointImpl.java
index faebec4b36..c68e19e75d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUserSavepointImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUserSavepointImpl.java
@@ -45,6 +45,11 @@ public abstract class CDOUserSavepointImpl implements InternalCDOUserSavepoint
public InternalCDOUserSavepoint getPreviousSavepoint()
{
+ return getPreviousSavepointUnsynced();
+ }
+
+ public InternalCDOUserSavepoint getPreviousSavepointUnsynced()
+ {
return previousSavepoint;
}
@@ -55,6 +60,11 @@ public abstract class CDOUserSavepointImpl implements InternalCDOUserSavepoint
public InternalCDOUserSavepoint getNextSavepoint()
{
+ return getNextSavepointUnsynced();
+ }
+
+ public InternalCDOUserSavepoint getNextSavepointUnsynced()
+ {
return nextSavepoint;
}
@@ -65,6 +75,11 @@ public abstract class CDOUserSavepointImpl implements InternalCDOUserSavepoint
public InternalCDOUserSavepoint getFirstSavePoint()
{
+ return getFirstSavePointUnsynced();
+ }
+
+ public InternalCDOUserSavepoint getFirstSavePointUnsynced()
+ {
return previousSavepoint != null ? previousSavepoint.getFirstSavePoint() : this;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
index 96c100176f..f53de33f71 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
@@ -1183,7 +1183,7 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
Object value = list.get(i);
value = store.resolveProxy(folderRevision, nodesFeature, i, value);
- CDOID childID = (CDOID)convertObjectToID(value);
+ CDOID childID = (CDOID)convertObjectToIDUnsynced(value, false);
InternalCDORevision childRevision = getLocalRevision(childID);
String childName = (String)childRevision.get(nameFeature, 0);
if (name.equals(childName))
@@ -1645,18 +1645,28 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
public InternalCDOObject getObject(CDOID id, boolean loadOnDemand)
{
- checkActive();
- if (CDOIDUtil.isNull(id))
- {
- return null;
- }
-
synchronized (getViewMonitor())
{
lockView();
try
{
+ return getObjectUnsynced(id, loadOnDemand);
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+ }
+
+ protected InternalCDOObject getObjectUnsynced(CDOID id, boolean loadOnDemand)
+ {
+ if (CDOIDUtil.isNull(id))
+ {
+ return null;
+ }
+
if (rootResource != null && rootResource.cdoID() == id)
{
return rootResource;
@@ -1712,12 +1722,6 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
lastLookupObject = localLookupObject;
return lastLookupObject;
}
- finally
- {
- unlockView();
- }
- }
- }
protected void excludeNewObject(CDOID id)
{
@@ -1772,7 +1776,7 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
}
CDOID id = object.cdoID();
- InternalCDOObject contextified = getObject(id, true);
+ InternalCDOObject contextified = getObjectUnsynced(id, true);
if (objectFromDifferentView instanceof CDOLegacyAdapter)
{
@@ -2005,7 +2009,18 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
try
{
- Object shouldBeCDOID = convertObjectToID(idOrObject);
+ return provideCDOIDUnsynced(idOrObject);
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+ }
+
+ protected final CDOID provideCDOIDUnsynced(Object idOrObject)
+ {
+ Object shouldBeCDOID = convertObjectToIDUnsynced(idOrObject, false);
if (shouldBeCDOID instanceof CDOID)
{
CDOID id = (CDOID)shouldBeCDOID;
@@ -2049,12 +2064,6 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOViewImpl.16"), idOrObject)); //$NON-NLS-1$
}
- finally
- {
- unlockView();
- }
- }
- }
public Object convertObjectToID(Object potentialObject)
{
@@ -2077,12 +2086,33 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
try
{
+ return convertObjectToIDInternal(potentialObject, onlyPersistedID);
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+ }
+
+ public Object convertObjectToIDUnsynced(Object potentialObject, boolean onlyPersistedID)
+ {
+ if (potentialObject instanceof CDOID)
+ {
+ return potentialObject;
+ }
+
+ return convertObjectToIDInternal(potentialObject, onlyPersistedID);
+ }
+
+ private Object convertObjectToIDInternal(Object potentialObject, boolean onlyPersistedID)
+ {
if (potentialObject instanceof InternalEObject)
{
if (potentialObject instanceof InternalCDOObject)
{
InternalCDOObject object = (InternalCDOObject)potentialObject;
- CDOID id = getID(object, onlyPersistedID);
+ CDOID id = getIDUnsynced(object, onlyPersistedID);
if (id != null)
{
return id;
@@ -2094,7 +2124,7 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
.getAdapter(((InternalEObject)potentialObject).eAdapters(), CDOLegacyAdapter.class);
if (object != null)
{
- CDOID id = getID(object, onlyPersistedID);
+ CDOID id = getIDUnsynced(object, onlyPersistedID);
if (id != null)
{
return id;
@@ -2107,14 +2137,8 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
return potentialObject;
}
- finally
- {
- unlockView();
- }
- }
- }
- protected CDOID getID(InternalCDOObject object, boolean onlyPersistedID)
+ protected final CDOID getID(InternalCDOObject object, boolean onlyPersistedID)
{
synchronized (getViewMonitor())
{
@@ -2122,6 +2146,17 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
try
{
+ return getIDUnsynced(object, onlyPersistedID);
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+ }
+
+ protected CDOID getIDUnsynced(InternalCDOObject object, boolean onlyPersistedID)
+ {
if (onlyPersistedID)
{
if (FSMUtil.isTransient(object) || FSMUtil.isNew(object))
@@ -2144,18 +2179,11 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
return object.cdoID();
}
- throw new IllegalArgumentException(
- "Object " + object + " is managed by a view with different target: " + view);
+ throw new IllegalArgumentException("Object " + object + " is managed by a view with different target: " + view);
}
return null;
}
- finally
- {
- unlockView();
- }
- }
- }
public Object convertIDToObject(Object potentialID)
{
@@ -2178,7 +2206,7 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
return getResourceSet().getEObject(URI.createURI(id.toURIFragment()), true);
}
- InternalCDOObject result = getObject(id, true);
+ InternalCDOObject result = getObjectUnsynced(id, true);
if (result == null)
{
throw new ImplementationError(MessageFormat.format(Messages.getString("CDOViewImpl.17"), id)); //$NON-NLS-1$
@@ -2365,7 +2393,7 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
}
}
- public void remapObject(CDOID oldID)
+ public final void remapObject(CDOID oldID)
{
synchronized (getViewMonitor())
{
@@ -2373,6 +2401,17 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
try
{
+ remapObjectUnsynced(oldID);
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+ }
+
+ protected void remapObjectUnsynced(CDOID oldID)
+ {
CDOID newID;
InternalCDOObject object = objects.remove(oldID);
newID = object.cdoID();
@@ -2390,12 +2429,6 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
TRACER.format("Remapping {0} --> {1}", oldID, newID); //$NON-NLS-1$
}
}
- finally
- {
- unlockView();
- }
- }
- }
public void addObjectHandler(CDOObjectHandler handler)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
index b5e8fb5787..c5c0d3e21a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
@@ -192,13 +192,13 @@ public final class CDOStoreImpl implements CDOStore
TRACER.format("get({0}, {1}, {2})", cdoObject, feature, index); //$NON-NLS-1$
}
- CDOFeatureAnalyzer featureAnalyzer = view.options().getFeatureAnalyzer();
+ CDOFeatureAnalyzer featureAnalyzer = view.getFeatureAnalyzerUnsynced();
featureAnalyzer.preTraverseFeature(cdoObject, feature, index);
InternalCDORevision revision = readRevision(cdoObject);
Object value = revision.get(feature, index);
- value = convertToEMF(eObject, revision, feature, index, value);
+ value = convertToEMFUnsynced(eObject, revision, feature, index, value);
featureAnalyzer.postTraverseFeature(cdoObject, feature, index, value);
return value;
@@ -245,7 +245,7 @@ public final class CDOStoreImpl implements CDOStore
return false;
}
- value = convertToEMF(eObject, revision, feature, NO_INDEX, value);
+ value = convertToEMFUnsynced(eObject, revision, feature, NO_INDEX, value);
Object defaultValue = feature.getDefaultValue();
return !ObjectUtil.equals(value, defaultValue);
}
@@ -327,7 +327,7 @@ public final class CDOStoreImpl implements CDOStore
TRACER.format("contains({0}, {1}, {2})", cdoObject, feature, value); //$NON-NLS-1$
}
- Object convertedValue = convertToCDO(cdoObject, feature, value);
+ Object convertedValue = convertToCDOUnsynced(cdoObject, feature, value);
InternalCDORevision revision = readRevision(cdoObject);
boolean result = revision.contains(feature, convertedValue);
@@ -364,7 +364,7 @@ public final class CDOStoreImpl implements CDOStore
TRACER.format("indexOf({0}, {1}, {2})", cdoObject, feature, value); //$NON-NLS-1$
}
- value = convertToCDO(cdoObject, feature, value);
+ value = convertToCDOUnsynced(cdoObject, feature, value);
InternalCDORevision revision = readRevision(cdoObject);
return revision.indexOf(feature, value);
@@ -393,7 +393,7 @@ public final class CDOStoreImpl implements CDOStore
TRACER.format("lastIndexOf({0}, {1}, {2})", cdoObject, feature, value); //$NON-NLS-1$
}
- value = convertToCDO(cdoObject, feature, value);
+ value = convertToCDOUnsynced(cdoObject, feature, value);
InternalCDORevision revision = readRevision(cdoObject);
return revision.lastIndexOf(feature, value);
@@ -453,7 +453,7 @@ public final class CDOStoreImpl implements CDOStore
Object[] result = revision.toArray(feature);
for (int i = 0; i < result.length; i++)
{
- result[i] = convertToEMF(eObject, revision, feature, i, result[i]);
+ result[i] = convertToEMFUnsynced(eObject, revision, feature, i, result[i]);
}
// // TODO Clarify feature maps
@@ -529,7 +529,8 @@ public final class CDOStoreImpl implements CDOStore
newContainerFeatureID);
}
- Object newContainerID = newEContainer == null ? CDOID.NULL : view.convertObjectToID(newEContainer, true);
+ Object newContainerID = newEContainer == null ? CDOID.NULL
+ : view.convertObjectToIDUnsynced(newEContainer, true);
CDOID newResourceID = newResource == null ? CDOID.NULL : newResource.cdoID();
CDOFeatureDelta delta = new CDOContainerFeatureDeltaImpl(newResourceID, newContainerID, newContainerFeatureID);
@@ -559,12 +560,12 @@ public final class CDOStoreImpl implements CDOStore
TRACER.format("set({0}, {1}, {2}, {3})", cdoObject, feature, index, value); //$NON-NLS-1$
}
- value = convertToCDO(cdoObject, feature, value);
+ value = convertToCDOUnsynced(cdoObject, feature, value);
// TODO: Use writeRevision() result!!
InternalCDORevision oldRevision = readRevision(cdoObject);
Object oldValue = oldRevision.get(feature, index);
- oldValue = convertToEMF(eObject, oldRevision, feature, index, oldValue);
+ oldValue = convertToEMFUnsynced(eObject, oldRevision, feature, index, oldValue);
CDOFeatureDelta delta = new CDOSetFeatureDeltaImpl(feature, index, value, oldValue);
writeRevision(cdoObject, delta);
@@ -634,7 +635,7 @@ public final class CDOStoreImpl implements CDOStore
TRACER.format("add({0}, {1}, {2}, {3})", cdoObject, feature, index, value); //$NON-NLS-1$
}
- value = convertToCDO(cdoObject, feature, value);
+ value = convertToCDOUnsynced(cdoObject, feature, value);
CDOFeatureDelta delta = new CDOAddFeatureDeltaImpl(feature, index, value);
writeRevision(cdoObject, delta);
@@ -784,29 +785,7 @@ public final class CDOStoreImpl implements CDOStore
try
{
- if (feature instanceof EReference)
- {
- value = view.convertObjectToID(value, true);
- }
- else if (FeatureMapUtil.isFeatureMap(feature))
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- Object convertedValue = view.convertObjectToID(innerValue);
- if (convertedValue != innerValue)
- {
- value = CDORevisionUtil.createFeatureMapEntry(innerFeature, convertedValue);
- }
- }
- else
- {
- CDOType type = CDOModelUtil.getType(feature.getEType());
- if (type != null)
- {
- value = type.convertToCDO(feature.getEType(), value);
- }
- }
+ value = convertToCDOInternal(feature, value);
}
finally
{
@@ -818,74 +797,126 @@ public final class CDOStoreImpl implements CDOStore
return value;
}
+ private Object convertToCDOUnsynced(InternalCDOObject object, EStructuralFeature feature, Object value)
+ {
+ if (value != null)
+ {
+ value = convertToCDOInternal(feature, value);
+ }
+
+ return value;
+ }
+
+ private Object convertToCDOInternal(EStructuralFeature feature, Object value)
+ {
+ if (feature instanceof EReference)
+ {
+ value = view.convertObjectToIDUnsynced(value, true);
+ }
+ else if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ FeatureMap.Entry entry = (FeatureMap.Entry)value;
+ EStructuralFeature innerFeature = entry.getEStructuralFeature();
+ Object innerValue = entry.getValue();
+ Object convertedValue = view.convertObjectToIDUnsynced(innerValue, false);
+ if (convertedValue != innerValue)
+ {
+ value = CDORevisionUtil.createFeatureMapEntry(innerFeature, convertedValue);
+ }
+ }
+ else
+ {
+ CDOType type = CDOModelUtil.getType(feature.getEType());
+ if (type != null)
+ {
+ value = type.convertToCDO(feature.getEType(), value);
+ }
+ }
+
+ return value;
+ }
+
/**
* @since 2.0
*/
public Object convertToEMF(EObject eObject, InternalCDORevision revision, EStructuralFeature feature, int index,
Object value)
{
- if (value != null)
+ if (value == null)
{
- synchronized (view.getViewMonitor())
+ return null;
+ }
+
+ synchronized (view.getViewMonitor())
+ {
+ view.lockView();
+
+ try
{
- view.lockView();
+ return convertToEMFUnsynced(eObject, revision, feature, index, value);
+ }
+ finally
+ {
+ view.unlockView();
+ }
+ }
+ }
- try
- {
- if (feature.isMany())
- {
- if (index == EStore.NO_INDEX)
- {
- return value;
- }
-
- value = resolveProxy(revision, feature, index, value);
- if (value instanceof CDOID)
- {
- CDOID id = (CDOID)value;
- CDOList list = revision.getList(feature);
- CDORevisionPrefetchingPolicy policy = view.options().getRevisionPrefetchingPolicy();
- InternalCDORevisionManager revisionManager = view.getSession().getRevisionManager();
- List<CDOID> listOfIDs = policy.loadAhead(revisionManager, view, eObject, feature, list, index, id);
- if (!listOfIDs.isEmpty())
- {
- int initialChunkSize = view.getSession().options().getCollectionLoadingPolicy().getInitialChunkSize();
- revisionManager.getRevisions(listOfIDs, view, initialChunkSize, CDORevision.DEPTH_NONE, true);
- }
- }
- }
+ private Object convertToEMFUnsynced(EObject eObject, InternalCDORevision revision, EStructuralFeature feature,
+ int index, Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
- if (feature instanceof EReference)
- {
- value = convertIDToObject(view, eObject, feature, index, value);
- }
- else if (FeatureMapUtil.isFeatureMap(feature))
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- Object convertedValue = convertIDToObject(view, eObject, feature, index, innerValue);
- if (convertedValue != innerValue)
- {
- value = FeatureMapUtil.createEntry(innerFeature, convertedValue);
- }
- }
- else
- {
- CDOType type = CDOModelUtil.getType(feature.getEType());
- if (type != null)
- {
- value = type.convertToEMF(feature.getEType(), value);
- }
- }
- }
- finally
+ if (feature.isMany())
+ {
+ if (index == EStore.NO_INDEX)
+ {
+ return value;
+ }
+
+ value = resolveProxy(revision, feature, index, value);
+ if (value instanceof CDOID)
+ {
+ CDOID id = (CDOID)value;
+ CDOList list = revision.getList(feature);
+ CDORevisionPrefetchingPolicy policy = view.options().getRevisionPrefetchingPolicy();
+ InternalCDORevisionManager revisionManager = view.getSession().getRevisionManager();
+ List<CDOID> listOfIDs = policy.loadAhead(revisionManager, view, eObject, feature, list, index, id);
+ if (!listOfIDs.isEmpty())
{
- view.unlockView();
+ int initialChunkSize = view.getSession().options().getCollectionLoadingPolicy().getInitialChunkSize();
+ revisionManager.getRevisions(listOfIDs, view, initialChunkSize, CDORevision.DEPTH_NONE, true);
}
}
}
+ if (feature instanceof EReference)
+ {
+ value = convertIDToObject(view, eObject, feature, index, value);
+ }
+ else if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ FeatureMap.Entry entry = (FeatureMap.Entry)value;
+ EStructuralFeature innerFeature = entry.getEStructuralFeature();
+ Object innerValue = entry.getValue();
+ Object convertedValue = convertIDToObject(view, eObject, feature, index, innerValue);
+ if (convertedValue != innerValue)
+ {
+ value = FeatureMapUtil.createEntry(innerFeature, convertedValue);
+ }
+ }
+ else
+ {
+ CDOType type = CDOModelUtil.getType(feature.getEType());
+ if (type != null)
+ {
+ value = type.convertToEMF(feature.getEType(), value);
+ }
+ }
+
return value;
}
@@ -950,7 +981,7 @@ public final class CDOStoreImpl implements CDOStore
}
Object oldValue = revision.get(feature, index);
- oldValue = convertToEMF(eObject, revision, feature, index, oldValue);
+ oldValue = convertToEMFUnsynced(eObject, revision, feature, index, oldValue);
return oldValue;
}
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 6322ba8f9e..de10d40f99 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
@@ -659,7 +659,7 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
}
else if (FSMUtil.isTransient(object))
{
- CDOID id = getID((InternalCDOObject)object, true);
+ CDOID id = getIDUnsynced((InternalCDOObject)object, true);
if (id != null)
{
objectIDs.add(id);
@@ -864,6 +864,11 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
}
}
+ public CDOFeatureAnalyzer getFeatureAnalyzerUnsynced()
+ {
+ return options().featureAnalyzer;
+ }
+
/**
* @since 2.0
*/
@@ -941,37 +946,25 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
}
@Override
- public void remapObject(CDOID oldID)
+ protected void remapObjectUnsynced(CDOID oldID)
{
- synchronized (getViewMonitor())
+ InternalCDOObject object = getObjectUnsynced(oldID, false);
+ InternalCDOLockState oldLockState = (InternalCDOLockState)lockStates.remove(object);
+ if (oldLockState != null)
{
- lockView();
-
- try
- {
- InternalCDOObject object = getObject(oldID, false);
- InternalCDOLockState oldLockState = (InternalCDOLockState)lockStates.remove(object);
- if (oldLockState != null)
- {
- Object lockedObject = getLockTarget(object); // CDOID or CDOIDAndBranch
- InternalCDOLockState newLockState = (InternalCDOLockState)CDOLockUtil.createLockState(lockedObject);
- newLockState.updateFrom(oldLockState);
- lockStates.put(object, newLockState);
- }
- else if (options().isLockStatePrefetchEnabled())
- {
- Object lockedObject = getLockTarget(object); // CDOID or CDOIDAndBranch
- CDOLockState newLockState = CDOLockUtil.createLockState(lockedObject);
- lockStates.put(object, newLockState);
- }
-
- super.remapObject(oldID);
- }
- finally
- {
- unlockView();
- }
+ Object lockedObject = getLockTarget(object); // CDOID or CDOIDAndBranch
+ InternalCDOLockState newLockState = (InternalCDOLockState)CDOLockUtil.createLockState(lockedObject);
+ newLockState.updateFrom(oldLockState);
+ lockStates.put(object, newLockState);
+ }
+ else if (options().isLockStatePrefetchEnabled())
+ {
+ Object lockedObject = getLockTarget(object); // CDOID or CDOIDAndBranch
+ CDOLockState newLockState = CDOLockUtil.createLockState(lockedObject);
+ lockStates.put(object, newLockState);
}
+
+ super.remapObjectUnsynced(oldID);
}
@Override
@@ -988,19 +981,7 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
public CDOLockState[] getLockStates(Collection<CDOID> ids)
{
- synchronized (getViewMonitor())
- {
- lockView();
-
- try
- {
- return getLockStates(ids, true);
- }
- finally
- {
- unlockView();
- }
- }
+ return getLockStates(ids, true);
}
protected CDOLockState[] getLockStates(Collection<CDOID> ids, boolean loadOnDemand)
@@ -1017,7 +998,7 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
for (CDOID id : ids)
{
- InternalCDOObject object = getObject(id, false);
+ InternalCDOObject object = getObjectUnsynced(id, false);
if (object != null)
{
CDOLockState lockState = lockStates.get(object);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java
index 64002bd50e..3d514c4e92 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSavepoint.java
@@ -28,10 +28,25 @@ public interface InternalCDOSavepoint extends CDOSavepoint, InternalCDOUserSavep
{
public InternalCDOTransaction getTransaction();
+ /**
+ * @since 4.6
+ */
+ public InternalCDOSavepoint getFirstSavePointUnsynced();
+
public InternalCDOSavepoint getFirstSavePoint();
+ /**
+ * @since 4.6
+ */
+ public InternalCDOSavepoint getPreviousSavepointUnsynced();
+
public InternalCDOSavepoint getPreviousSavepoint();
+ /**
+ * @since 4.6
+ */
+ public InternalCDOSavepoint getNextSavepointUnsynced();
+
public InternalCDOSavepoint getNextSavepoint();
public void clear();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java
index 0acd248225..38ab2997ba 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOUserSavepoint.java
@@ -24,10 +24,25 @@ public interface InternalCDOUserSavepoint extends CDOUserSavepoint
{
public InternalCDOUserTransaction getTransaction();
+ /**
+ * @since 4.6
+ */
+ public InternalCDOUserSavepoint getFirstSavePointUnsynced();
+
public InternalCDOUserSavepoint getFirstSavePoint();
+ /**
+ * @since 4.6
+ */
+ public InternalCDOUserSavepoint getPreviousSavepointUnsynced();
+
public InternalCDOUserSavepoint getPreviousSavepoint();
+ /**
+ * @since 4.6
+ */
+ public InternalCDOUserSavepoint getNextSavepointUnsynced();
+
public InternalCDOUserSavepoint getNextSavepoint();
public void setPreviousSavepoint(InternalCDOUserSavepoint previousSavepoint);
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 3c4dc5c838..4b72192bc0 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
@@ -69,6 +69,11 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
public void setViewSet(InternalCDOViewSet viewSet);
+ /**
+ * @since 4.6
+ */
+ public CDOFeatureAnalyzer getFeatureAnalyzerUnsynced();
+
@Deprecated
public CDOFeatureAnalyzer getFeatureAnalyzer();
@@ -167,6 +172,11 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
public Object convertObjectToID(Object potentialObject, boolean onlyPersistedID);
+ /**
+ * @since 4.6
+ */
+ public Object convertObjectToIDUnsynced(Object potentialObject, boolean onlyPersistedID);
+
public Object convertIDToObject(Object potentialID);
/**

Back to the top