summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2008-05-22 15:29:41 (EDT)
committerSimon McDuff2008-05-22 15:29:41 (EDT)
commitf060e6081b32db0db5116ec8eb0b8277af59823d (patch)
treeb45f70ad52885b244dc8d19f6fa54809db8d225e
parentc881310e1104decf5183fa79e8a68b23a33b3c53 (diff)
downloadcdo-f060e6081b32db0db5116ec8eb0b8277af59823d.zip
cdo-f060e6081b32db0db5116ec8eb0b8277af59823d.tar.gz
cdo-f060e6081b32db0db5116ec8eb0b8277af59823d.tar.bz2
[233314] Add CDOTransactionHandler.rollingbackTransaction()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=233314
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java70
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CDOPackageRegistryImpl.java4
3 files changed, 54 insertions, 27 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
index 701f895..6c1dc04 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
@@ -8,6 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
* Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=201266
+ * Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=233314
**************************************************************************/
package org.eclipse.emf.cdo;
@@ -40,4 +41,10 @@ public interface CDOTransactionHandler
* transaction.
*/
public void committingTransaction(CDOTransaction transaction);
+
+ /**
+ * Called by a <code>CDOTransaction</code> <b>after</b> it is being rolled back. If the implementor of this method
+ * throw an exception other listener would not be notify and the exception will be propagated.
+ */
+ public void rollingbackTransaction(CDOTransaction transaction);
}
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 f3b2640..17ddf12 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
@@ -8,6 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
* Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=201266
+ * Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=233314
**************************************************************************/
package org.eclipse.emf.internal.cdo;
@@ -272,44 +273,59 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
public void rollback(boolean remote)
{
- try
+ if (dirty)
{
- if (!newResources.isEmpty())
+ if (TRACER.isEnabled())
{
- for (CDOObject newResource : newResources.values())
- {
- removeObject(newResource.cdoID());
- getResourceSet().getResources().remove(newResource);
- }
+ TRACER.trace("commit()");
}
- if (!newObjects.isEmpty())
+ try
{
- for (CDOObject newObject : newObjects.values())
+ if (!newResources.isEmpty())
{
- removeObject(newObject.cdoID());
+ for (CDOObject newResource : newResources.values())
+ {
+ removeObject(newResource.cdoID());
+ getResourceSet().getResources().remove(newResource);
+ }
}
- }
- if (!dirtyObjects.isEmpty())
- {
- for (CDOObject dirtyObject : dirtyObjects.values())
+ if (!newObjects.isEmpty())
{
- CDOStateMachine.INSTANCE.rollback((InternalCDOObject)dirtyObject, remote);
+ for (CDOObject newObject : newObjects.values())
+ {
+ removeObject(newObject.cdoID());
+ }
}
- }
- cleanUp();
- Map<CDOIDTemp, CDOID> idMappings = Collections.emptyMap();
- fireEvent(new FinishedEvent(CDOTransactionFinishedEvent.Type.ROLLED_BACK, idMappings));
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new TransactionException(ex);
+ if (!dirtyObjects.isEmpty())
+ {
+ for (CDOObject dirtyObject : dirtyObjects.values())
+ {
+ CDOStateMachine.INSTANCE.rollback((InternalCDOObject)dirtyObject, remote);
+ }
+ }
+
+ cleanUp();
+
+ Map<CDOIDTemp, CDOID> idMappings = Collections.emptyMap();
+
+ fireEvent(new FinishedEvent(CDOTransactionFinishedEvent.Type.ROLLED_BACK, idMappings));
+
+ for (CDOTransactionHandler handler : getHandlers())
+ {
+ handler.rollingbackTransaction(this);
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new TransactionException(ex);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CDOPackageRegistryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CDOPackageRegistryImpl.java
index f1c4ea0..0c68ca6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CDOPackageRegistryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CDOPackageRegistryImpl.java
@@ -311,6 +311,10 @@ public class CDOPackageRegistryImpl extends EPackageRegistryImpl implements CDOP
public void committingTransaction(CDOTransaction transaction)
{
}
+
+ public void rollingbackTransaction(CDOTransaction transaction)
+ {
+ }
}
/**