Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-08-14 06:52:36 +0000
committerEike Stepper2012-08-14 06:52:36 +0000
commita544a46a4d07b13b69c3bfa1d1cc594f535451b1 (patch)
tree099a0981ab68550a2eae0337f440129065423196 /plugins
parent6528637024f680f530a08d8d1830c23a99c2c460 (diff)
downloadcdo-a544a46a4d07b13b69c3bfa1d1cc594f535451b1.tar.gz
cdo-a544a46a4d07b13b69c3bfa1d1cc594f535451b1.tar.xz
cdo-a544a46a4d07b13b69c3bfa1d1cc594f535451b1.zip
Remove CDOPackageInfo adapters in TransactionCommitContext.rollback()
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java34
2 files changed, 42 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
index a441c90ccf..b4b2f24869 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
@@ -136,18 +136,21 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori
TRACER.format("Reading {0} new package units", newPackageUnits.length); //$NON-NLS-1$
}
- InternalCDOPackageRegistry packageRegistry = commitContext.getPackageRegistry();
- ResourceSet resourceSet = createResourceSet(packageRegistry);
- for (int i = 0; i < newPackageUnits.length; i++)
+ if (newPackageUnits.length != 0)
{
- newPackageUnits[i] = (InternalCDOPackageUnit)in.readCDOPackageUnit(resourceSet);
- packageRegistry.putPackageUnit(newPackageUnits[i]); // Must happen before readCDORevision!!!
- monitor.worked();
- }
+ InternalCDOPackageRegistry packageRegistry = commitContext.getPackageRegistry();
+ ResourceSet resourceSet = createResourceSet(packageRegistry);
+ for (int i = 0; i < newPackageUnits.length; i++)
+ {
+ newPackageUnits[i] = (InternalCDOPackageUnit)in.readCDOPackageUnit(resourceSet);
+ packageRegistry.putPackageUnit(newPackageUnits[i]); // Must happen before readCDORevision!!!
+ monitor.worked();
+ }
- // When all packages are deserialized and registered, resolve them
- // Note: EcoreUtil.resolveAll(resourceSet) does *not* do the trick
- EMFUtil.safeResolveAll(resourceSet);
+ // When all packages are deserialized and registered, resolve them
+ // Note: EcoreUtil.resolveAll(resourceSet) does *not* do the trick
+ EMFUtil.safeResolveAll(resourceSet);
+ }
// Locks on new objects
if (TRACER.isEnabled())
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
index 2623c899c3..2f8bc7f060 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
@@ -182,8 +182,6 @@ public class TransactionCommitContext implements InternalCommitContext
ensuringReferentialIntegrity = repository.isEnsuringReferentialIntegrity();
repositoryPackageRegistry = repository.getPackageRegistry(false);
- packageRegistry = new TransactionPackageRegistry(repositoryPackageRegistry);
- packageRegistry.activate();
}
public InternalTransaction getTransaction()
@@ -223,6 +221,12 @@ public class TransactionCommitContext implements InternalCommitContext
public InternalCDOPackageRegistry getPackageRegistry()
{
+ if (packageRegistry == null)
+ {
+ packageRegistry = new TransactionPackageRegistry(repositoryPackageRegistry);
+ packageRegistry.activate();
+ }
+
return packageRegistry;
}
@@ -1114,7 +1118,10 @@ public class TransactionCommitContext implements InternalCommitContext
if (rollbackMessage == null)
{
rollbackMessage = message;
+
+ removePackageAdapters();
unlockObjects();
+
if (accessor != null)
{
try
@@ -1123,7 +1130,7 @@ public class TransactionCommitContext implements InternalCommitContext
}
catch (RuntimeException ex)
{
- OM.LOG.warn("Problem while rolling back the transaction", ex); //$NON-NLS-1$
+ OM.LOG.warn("Problem while rolling back the transaction", ex); //$NON-NLS-1$
}
finally
{
@@ -1133,6 +1140,22 @@ public class TransactionCommitContext implements InternalCommitContext
}
}
+ private void removePackageAdapters()
+ {
+ for (int i = 0; i < newPackageUnits.length; i++)
+ {
+ try
+ {
+ InternalCDOPackageUnit packageUnit = newPackageUnits[i];
+ packageUnit.dispose();
+ }
+ catch (Throwable t)
+ {
+ OM.LOG.error(t);
+ }
+ }
+ }
+
protected IStoreAccessor getAccessor()
{
return accessor;
@@ -1229,8 +1252,9 @@ public class TransactionCommitContext implements InternalCommitContext
monitor.begin(newPackageUnits.length);
for (int i = 0; i < newPackageUnits.length; i++)
{
- newPackageUnits[i].setState(CDOPackageUnit.State.LOADED);
- repositoryPackageRegistry.putPackageUnit(newPackageUnits[i]);
+ InternalCDOPackageUnit packageUnit = newPackageUnits[i];
+ packageUnit.setState(CDOPackageUnit.State.LOADED);
+ repositoryPackageRegistry.putPackageUnit(packageUnit);
monitor.worked();
}
}

Back to the top