Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 87348 Details for
Bug 214752
Concurrency problem with getRevision()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Update v3
update-v3.txt (text/plain), 9.36 KB, created by
Eike Stepper
on 2008-01-20 06:46:43 EST
(
hide
)
Description:
Update v3
Filename:
MIME Type:
Creator:
Eike Stepper
Created:
2008-01-20 06:46:43 EST
Size:
9.36 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.cdo.server >Index: src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java,v >retrieving revision 1.8 >diff -u -r1.8 MEMStoreAccessor.java >--- src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java 20 Jan 2008 01:58:48 -0000 1.8 >+++ src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java 20 Jan 2008 11:44:53 -0000 >@@ -83,29 +83,8 @@ > > public CDORevision readRevision(CDOID id, int referenceChunk) > { >- InternalCDORevision storeRevision = (InternalCDORevision)getStore().getRevision(id); >- // IRevisionManager revisionManager = getStore().getRepository().getRevisionManager(); >- // InternalCDORevision newRevision = new InternalCDORevision(revisionManager, storeRevision.getCDOClass(), >- // storeRevision >- // .getID()); >- // newRevision.setResourceID(storeRevision.getResourceID()); >- // >- // for (CDOFeature feature : storeRevision.getCDOClass().getAllFeatures()) >- // { >- // if (feature.isMany()) >- // { >- // newRevision.setListSize(feature, storeRevision.getList(feature).size()); >- // MoveableList<Object> list = newRevision.getList(feature); >- // int size = referenceChunk == CDORevision.UNCHUNKED ? list.size() : referenceChunk; >- // for (int i = 0; i < size; i++) >- // { >- // list.set(i, storeRevision.get(feature, i)); >- // } >- // } >- // } >- // >- // return newRevision; >- return storeRevision; >+ CDORevision storeRevision = getStore().getRevision(id); >+ return CDORevisionUtil.copy(storeRevision); > } > > public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp) >@@ -115,7 +94,12 @@ > > public CDORevision readRevisionByVersion(CDOID id, int referenceChunk, int version) > { >- throw new UnsupportedOperationException(); >+ CDORevision rev = getStore().getRevisionByVersion(id, version); >+ if (rev == null) >+ { >+ throw new IllegalStateException("Cannot find id " + id + " with version " + version); >+ } >+ return CDORevisionUtil.copy(rev); > } > > public CDOID readResourceID(String path) >@@ -134,7 +118,9 @@ > > public void writeRevision(InternalCDORevision revision) > { >- newRevisions.add(revision); >+ CDORevision newRevision = CDORevisionUtil.copy(revision); >+ getStore().addRevision(newRevision); >+ newRevisions.add(newRevision); > } > > @Override >@@ -143,10 +129,22 @@ > InternalCDORevision revision = (InternalCDORevision)getStore().getRevision(delta.getID()); > InternalCDORevision newRevision = (InternalCDORevision)CDORevisionUtil.copy(revision); > delta.apply(newRevision); >+ getStore().addRevision(newRevision); > newRevisions.add(newRevision); > } > > @Override >+ public InternalCDORevision verifyRevision(CDORevision revision) >+ { >+ InternalCDORevision storeRevision = (InternalCDORevision)getStore().getRevision(revision.getID()); >+ if (storeRevision.getVersion() != revision.getVersion()) >+ { >+ revision = CDORevisionUtil.copy(storeRevision); >+ } >+ return (InternalCDORevision)revision; >+ } >+ >+ @Override > public void release() > { > newRevisions.clear(); >@@ -154,14 +152,14 @@ > > public void commit() > { >- MEMStore store = getStore(); >- for (CDORevision revision : newRevisions) >- { >- store.addRevision(revision); >- } > } > > public void rollback() > { >+ MEMStore store = getStore(); >+ for (CDORevision revision : newRevisions) >+ { >+ store.removeRevision(revision); >+ } > } > } >#P org.eclipse.emf.cdo.tests >Index: src/org/eclipse/emf/cdo/tests/RollbackTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RollbackTest.java,v >retrieving revision 1.2 >diff -u -r1.2 RollbackTest.java >--- src/org/eclipse/emf/cdo/tests/RollbackTest.java 28 Dec 2007 12:56:53 -0000 1.2 >+++ src/org/eclipse/emf/cdo/tests/RollbackTest.java 20 Jan 2008 11:44:55 -0000 >@@ -56,9 +56,11 @@ > { > // Client1 > CDOResource resource1 = transaction1.createResource("/test1"); >+ > Company company1 = Model1Factory.eINSTANCE.createCompany(); >- resource1.getContents().add(company1); > Category category1 = Model1Factory.eINSTANCE.createCategory(); >+ >+ resource1.getContents().add(company1); > company1.getCategories().add(category1); > transaction1.commit(); > >@@ -66,6 +68,8 @@ > CDOResource resource2 = transaction2.getResource("/test1"); > Company company2 = (Company)resource2.getContents().get(0); > Category category2 = company2.getCategories().get(0); >+ >+ company2.setName("company2"); > category2.setName("client2"); > > // Client1 >@@ -90,16 +94,50 @@ > assertEquals(false, transaction2.isDirty()); > assertEquals(false, transaction2.hasConflict()); > assertEquals("client1", category2.getName()); >+ assertEquals(null, company2.getName()); >+ { >+ CDOTransaction transaction3 = createNewTransaction(); >+ CDOResource resource3 = transaction3.getResource("/test1"); >+ Company company3 = (Company)resource3.getContents().get(0); >+ Category category3 = company3.getCategories().get(0); >+ assertEquals(null, company3.getName()); >+ assertEquals("client1", category3.getName()); >+ transaction3.close(); >+ transaction3.getSession().close(); >+ } >+ > category2.setName("client2"); >+ company2.setName("company2"); >+ > transaction2.commit(); > assertEquals(false, transaction2.isDirty()); > assertEquals(false, transaction2.hasConflict()); >+ assertEquals("company2", company2.getName()); > assertEquals("client2", category2.getName()); > sleep(500); > >+ { >+ CDOTransaction transaction3 = createNewTransaction(); >+ CDOResource resource3 = transaction3.getResource("/test1"); >+ Company company3 = (Company)resource3.getContents().get(0); >+ Category category3 = company3.getCategories().get(0); >+ assertEquals("company2", company3.getName()); >+ assertEquals("client2", category3.getName()); >+ transaction3.close(); >+ transaction3.getSession().close(); >+ } >+ > // Client1 > assertEquals(false, transaction1.isDirty()); > assertEquals(false, transaction1.hasConflict()); > assertEquals("client2", category1.getName()); >+ assertEquals("company2", company1.getName()); >+ } >+ >+ private CDOTransaction createNewTransaction() >+ { >+ CDOSession session = CDOUtil.openSession(getConnector(), REPOSITORY_NAME); >+ session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE); >+ return session.openTransaction(); > } > } >Index: src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java,v >retrieving revision 1.14 >diff -u -r1.14 AbstractCDOTest.java >--- src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java 19 Jan 2008 18:07:17 -0000 1.14 >+++ src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java 20 Jan 2008 11:44:55 -0000 >@@ -59,9 +59,11 @@ > protected Repository createRepository() > { > Map<String, String> props = new HashMap<String, String>(); >- // props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true"); >- // props.put(IRepository.PROP_CURRENT_LRU_CAPACITY, "20"); >- // props.put(IRepository.PROP_REVISED_LRU_CAPACITY, "20"); >+ props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true"); >+ props.put(IRepository.PROP_VERIFYING_REVISIONS, "true"); >+ >+ // props.put(IRepository.PROP_CURRENT_LRU_CAPACITY, "10"); >+ // props.put(IRepository.PROP_REVISED_LRU_CAPACITY, "10"); > > IStore store = createStore(); > >Index: src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java,v >retrieving revision 1.5 >diff -u -r1.5 ChunkingWithMEMTest.java >--- src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java 19 Jan 2008 18:07:17 -0000 1.5 >+++ src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java 20 Jan 2008 11:44:55 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.emf.cdo.internal.server.Repository; > import org.eclipse.emf.cdo.internal.server.RevisionManager; > import org.eclipse.emf.cdo.protocol.revision.CDORevision; >+import org.eclipse.emf.cdo.server.IRepository; > import org.eclipse.emf.cdo.server.IStore; > import org.eclipse.emf.cdo.tests.model1.Customer; > import org.eclipse.emf.cdo.tests.model1.Model1Factory; >@@ -156,7 +157,8 @@ > protected Repository createRepository() > { > Map<String, String> props = new HashMap<String, String>(); >- // props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true"); >+ props.put(IRepository.PROP_SUPPORTING_REVISION_DELTAS, "true"); >+ props.put(IRepository.PROP_VERIFYING_REVISIONS, "true"); > > IStore store = createStore(); > Repository repository = new Repository()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 214752
:
87319
|
87326
|
87327
|
87328
|
87329
|
87330
|
87343
|
87344
| 87348