Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-03-04 11:55:27 +0000
committerEike Stepper2020-03-04 11:55:27 +0000
commit3781607e06f87a1f423e83df1f259aa3a609e63c (patch)
tree6b66dc27adea514ad0cdfa2b083db20236606539
parent70c8096b93c7ce3ffae830b2a58e15398c335e2b (diff)
downloadcdo-3781607e06f87a1f423e83df1f259aa3a609e63c.tar.gz
cdo-3781607e06f87a1f423e83df1f259aa3a609e63c.tar.xz
cdo-3781607e06f87a1f423e83df1f259aa3a609e63c.zip
[560598] Deadlock during the loading of a CDOLegacyWrapper
https://bugs.eclipse.org/bugs/show_bug.cgi?id=560598
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java129
1 files changed, 63 insertions, 66 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java
index 243b68c1a1..37f21d0a20 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java
@@ -495,95 +495,92 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
protected void revisionToInstance()
{
- synchronized (recursionCounter)
+ if (underConstruction)
{
- if (underConstruction)
- {
- // Return if revisionToInstance was called before to avoid doubled calls
- return;
- }
+ // Return if revisionToInstance was called before to avoid doubled calls
+ return;
+ }
- underConstruction = true;
- InternalCDORevision revision = cdoRevision();
+ underConstruction = true;
+ InternalCDORevision revision = cdoRevision();
- if (TRACER.isEnabled())
- {
- TRACER.format("Transfering revision to instance: {0} --> {1}", revision, instance); //$NON-NLS-1$
- }
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Transfering revision to instance: {0} --> {1}", revision, instance); //$NON-NLS-1$
+ }
- boolean deliver = instance.eDeliver();
- if (deliver)
+ boolean deliver = instance.eDeliver();
+ if (deliver)
+ {
+ instance.eSetDeliver(false);
+ }
+
+ Counter counter = recursionCounter.get();
+ if (counter == null)
+ {
+ counter = new Counter();
+ recursionCounter.set(counter);
+ }
+
+ InternalCDOResource resource = null;
+ boolean bypassPermissionChecks = revision.bypassPermissionChecks(true);
+
+ try
+ {
+ registerWrapper(this);
+ counter.increment();
+ viewAndState.view.registerObject(this);
+
+ revisionToInstanceResource();
+ revisionToInstanceContainer();
+
+ Resource eResource = instance.eResource();
+ if (eResource instanceof InternalCDOResource)
{
- instance.eSetDeliver(false);
+ resource = (InternalCDOResource)eResource;
+ resource.cdoInternalLoading(instance);
}
- Counter counter = recursionCounter.get();
- if (counter == null)
+ for (EStructuralFeature feature : classInfo.getAllPersistentFeatures())
{
- counter = new Counter();
- recursionCounter.set(counter);
+ revisionToInstanceFeature(feature);
}
-
- InternalCDOResource resource = null;
- boolean bypassPermissionChecks = revision.bypassPermissionChecks(true);
-
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ throw new CDOException(ex);
+ }
+ finally
+ {
try
{
- registerWrapper(this);
- counter.increment();
- viewAndState.view.registerObject(this);
-
- revisionToInstanceResource();
- revisionToInstanceContainer();
+ revision.bypassPermissionChecks(bypassPermissionChecks);
- Resource eResource = instance.eResource();
- if (eResource instanceof InternalCDOResource)
+ if (resource != null)
{
- resource = (InternalCDOResource)eResource;
- resource.cdoInternalLoading(instance);
+ resource.cdoInternalLoadingDone(instance);
}
- for (EStructuralFeature feature : classInfo.getAllPersistentFeatures())
+ if (deliver)
{
- revisionToInstanceFeature(feature);
+ instance.eSetDeliver(true);
}
}
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- throw ex;
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- throw new CDOException(ex);
- }
finally
{
- try
+ if (counter.decrement() == 0)
{
- revision.bypassPermissionChecks(bypassPermissionChecks);
-
- if (resource != null)
- {
- resource.cdoInternalLoadingDone(instance);
- }
-
- if (deliver)
- {
- instance.eSetDeliver(true);
- }
+ recursionCounter.remove();
}
- finally
- {
- if (counter.decrement() == 0)
- {
- recursionCounter.remove();
- }
- unregisterWrapper(this);
- underConstruction = false;
- }
+ unregisterWrapper(this);
+ underConstruction = false;
}
}
}

Back to the top