Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-06-12 09:05:23 +0000
committerEike Stepper2008-06-12 09:05:23 +0000
commit2d61b9a45469e1b300787e431d435d19b96833dd (patch)
tree63f046c013793f0605312ac47bf26423d3676e32 /plugins
parentb28d7b289603ebbfd3ddda6cab2d184da88a79ef (diff)
downloadcdo-2d61b9a45469e1b300787e431d435d19b96833dd.tar.gz
cdo-2d61b9a45469e1b300787e431d435d19b96833dd.tar.xz
cdo-2d61b9a45469e1b300787e431d435d19b96833dd.zip
[236784] Invalidate and cache problem
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236784
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDAndVersion.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDAndVersionImpl.java89
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java14
7 files changed, 157 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDAndVersion.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDAndVersion.java
new file mode 100644
index 0000000000..68d56443df
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDAndVersion.java
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDAndVersion
+{
+ public CDOID getID();
+
+ public int getVersion();
+
+ public void write(ExtendedDataOutput out, boolean asLegacy) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
index 85829635c6..2ae20f9797 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.common.id.CDOID.Type;
import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDAndVersionImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDMetaImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDMetaRangeImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDTempMetaImpl;
@@ -257,4 +258,20 @@ public final class CDOIDUtil
{
return new CDOIDLibraryDescriptorImpl(in);
}
+
+ public static CDOIDAndVersion createIDAndVersion(CDOID id, int version)
+ {
+ return new CDOIDAndVersionImpl(id, version);
+ }
+
+ public static CDOIDAndVersion readIDAndVersion(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return readIDAndVersion(in, factory, false);
+ }
+
+ public static CDOIDAndVersion readIDAndVersion(ExtendedDataInput in, CDOIDObjectFactory factory, boolean asLegacy)
+ throws IOException
+ {
+ return new CDOIDAndVersionImpl(in, factory, asLegacy);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDAndVersionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDAndVersionImpl.java
new file mode 100644
index 0000000000..9c513be825
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDAndVersionImpl.java
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOIDAndVersionImpl implements CDOIDAndVersion
+{
+ private CDOID id;
+
+ private int version;
+
+ public CDOIDAndVersionImpl(CDOID id, int version)
+ {
+ this.id = id;
+ this.version = version;
+ }
+
+ public CDOIDAndVersionImpl(ExtendedDataInput in, CDOIDObjectFactory factory, boolean asLegacy) throws IOException
+ {
+ id = CDOIDUtil.read(in, factory, asLegacy);
+ version = in.readInt();
+ }
+
+ public void write(ExtendedDataOutput out, boolean asLegacy) throws IOException
+ {
+ CDOIDUtil.write(out, id, asLegacy);
+ out.writeInt(version);
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOIDAndVersion)
+ {
+ CDOIDAndVersion that = (CDOIDAndVersion)obj;
+ return id.equals(that.getID()) && version == that.getVersion();
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return id.hashCode() ^ version;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}v{1}", id, version);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index 9a013d9827..a547b04171 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -530,13 +530,6 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
{
InternalCDORevision revision = (InternalCDORevision)object.cdoRevision();
revision.setRevised(timeStamp - 1);
-
- // CDOViewImpl view = (CDOViewImpl)object.cdoView();
- // InternalCDORevision baseRevision = view.getRevision(object.cdoID(), false);
- // if (baseRevision != null && baseRevision.getVersion() + 1 == revision.getVersion())
- // {
- // baseRevision.setRevised(timeStamp - 1);
- // }
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index 229d0842ce..91037a6e5e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -18,9 +18,11 @@ import org.eclipse.emf.cdo.CDOTransactionFinishedEvent;
import org.eclipse.emf.cdo.CDOTransactionHandler;
import org.eclipse.emf.cdo.CDOTransactionStartedEvent;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaUtil;
@@ -252,7 +254,15 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
if (!dirtyObjects.isEmpty())
{
- session.notifyInvalidation(result.getTimeStamp(), dirtyObjects.keySet(), this);
+ Set<CDOIDAndVersion> dirtyIDs = new HashSet<CDOIDAndVersion>();
+ for (CDOObject dirtyObject : dirtyObjects.values())
+ {
+ CDORevision revision = dirtyObject.cdoRevision();
+ CDOIDAndVersion dirtyID = CDOIDUtil.createIDAndVersion(revision.getID(), revision.getVersion());
+ dirtyIDs.add(dirtyID);
+ }
+
+ session.notifyInvalidation(result.getTimeStamp(), dirtyIDs, this);
}
cleanUp();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 1fee02b189..d3f93aa24d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.cdo.CDOViewEvent;
import org.eclipse.emf.cdo.CDOViewResourcesEvent;
import org.eclipse.emf.cdo.analyzer.CDOFeatureAnalyzer;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDObject;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
@@ -586,15 +587,15 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
* 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).
*/
- public void notifyInvalidation(long timeStamp, Set<CDOID> dirtyOIDs)
+ public void notifyInvalidation(long timeStamp, Set<CDOIDAndVersion> dirtyOIDs)
{
List<InternalCDOObject> dirtyObjects = invalidationNotificationsEnabled ? new ArrayList<InternalCDOObject>() : null;
- for (CDOID dirtyOID : dirtyOIDs)
+ for (CDOIDAndVersion dirtyOID : dirtyOIDs)
{
InternalCDOObject dirtyObject;
synchronized (objects)
{
- dirtyObject = objects.get(dirtyOID);
+ dirtyObject = objects.get(dirtyOID.getID());
if (dirtyObject != null)
{
CDOStateMachine.INSTANCE.invalidate(dirtyObject, timeStamp);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java
index 347ff33451..ce2d4ccff9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/InvalidationIndication.java
@@ -11,7 +11,7 @@
package org.eclipse.emf.internal.cdo.protocol;
import org.eclipse.emf.cdo.common.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.internal.cdo.CDOSessionImpl;
@@ -54,18 +54,22 @@ public class InvalidationIndication extends Indication
int size = in.readInt();
if (PROTOCOL.isEnabled())
{
- PROTOCOL.format("Reading {0} IDs", size);
+ PROTOCOL.format("Reading {0} dirty IDs", size);
}
CDOSessionImpl session = getSession();
- Set<CDOID> dirtyOIDs = new HashSet<CDOID>();
+ Set<CDOIDAndVersion> dirtyOIDs = new HashSet<CDOIDAndVersion>();
for (int i = 0; i < size; i++)
{
- CDOID dirtyOID = CDOIDUtil.read(in, session);
+ CDOIDAndVersion dirtyOID = CDOIDUtil.readIDAndVersion(in, session);
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read dirty ID: {0}", dirtyOID);
+ }
+
dirtyOIDs.add(dirtyOID);
}
- // ConcurrencyUtil.sleep(100);
session.notifyInvalidation(timeStamp, dirtyOIDs, null);
}

Back to the top