diff options
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 701f895358..6c1dc045a1 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 f3b2640af1..17ddf123e6 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 f1c4ea0945..0c68ca6afc 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) + { + } } /** |