summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-16 03:34:58 (EDT)
committerEike Stepper2007-09-16 03:34:58 (EDT)
commit43f330002d71b89318a74f3340964b1fc35edff9 (patch)
treebedd21082b2f3907f647396895442f077306285b
parent4b05637e491b7c5df15e2751b6bd196b2c2839df (diff)
downloadcdo-43f330002d71b89318a74f3340964b1fc35edff9.zip
cdo-43f330002d71b89318a74f3340964b1fc35edff9.tar.gz
cdo-43f330002d71b89318a74f3340964b1fc35edff9.tar.bz2
[203528] LookAhead problem with temporary
https://bugs.eclipse.org/bugs/show_bug.cgi?id=203528
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java45
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java10
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java10
3 files changed, 58 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java
index d08b8eb..b34bccf 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.tests.model1.Model1Factory;
import org.eclipse.emf.cdo.tests.model1.SalesOrder;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import java.util.Iterator;
@@ -134,4 +135,48 @@ public class ChunkingTest extends AbstractCDOTest
transaction.commit();
}
+
+ public void testChunkWithTemporaryObject() throws Exception
+ {
+ {
+ msg("Opening session");
+ CDOSession session = openModel1Session();
+
+ msg("Attaching transaction");
+ CDOTransaction transaction = session.openTransaction(new ResourceSetImpl());
+
+ msg("Creating resource");
+ CDOResource resource = transaction.createResource("/test1");
+
+ msg("Creating customer");
+ Customer customer = Model1Factory.eINSTANCE.createCustomer();
+ customer.setName("customer");
+ resource.getContents().add(customer);
+
+ msg("Committing");
+ transaction.commit();
+ }
+
+ // ************************************************************* //
+
+ msg("Opening session");
+ CDOSession session = openModel1Session();
+
+ msg("Attaching transaction");
+ CDOTransaction transaction = session.openTransaction(new ResourceSetImpl());
+ transaction.setLoadRevisionCollectionChunkSize(10);
+
+ msg("Loading resource");
+ CDOResource resource = transaction.getResource("/test1");
+
+ Customer customer = Model1Factory.eINSTANCE.createCustomer();
+ customer.setName("customer");
+ resource.getContents().add(customer);
+ for (EObject element : resource.getContents())
+ {
+ System.out.println(element);
+ }
+
+ transaction.commit();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
index 3330591..bb693f2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
@@ -140,11 +140,15 @@ public final class CDOStore implements EStore
Object element = list.get(i);
if (element instanceof CDOID)
{
- if (!revisionManager.containsRevision((CDOID)element))
+ CDOID idElement = (CDOID)element;
+ if (!idElement.isTemporary())
{
- if (!notRegistered.contains(element))
+ if (!revisionManager.containsRevision(idElement))
{
- notRegistered.add((CDOID)element);
+ if (!notRegistered.contains(idElement))
+ {
+ notRegistered.add(idElement);
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java
index 93c5250..72edec2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java
@@ -64,11 +64,13 @@ public class LoadChunkRequest extends CDOClientRequest<CDOID>
@Override
protected void requesting(ExtendedDataOutputStream out) throws IOException
{
- if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing revision ID: {0}", revision.getID());
- CDOIDImpl.write(out, revision.getID());
+ CDOID id = revision.getID();
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing revision ID: {0}", id);
+ CDOIDImpl.write(out, id);
- if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing revision version: {0}", revision.getVersion());
- out.writeInt(revision.getVersion());
+ int version = revision.getVersion();
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing revision version: {0}", version);
+ out.writeInt(version);
if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing feature: {0}", feature);
CDOClassRefImpl classRef = (CDOClassRefImpl)feature.getContainingClass().createClassRef();