Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2013-08-26 17:51:07 +0000
committerThomas Watson2013-08-26 17:51:07 +0000
commitb02f5f661385ce014acdb16681458e600580e643 (patch)
treef6e751b960b1cfc3ffaf893baa69630380213c3d /bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java
parent4bb71f0fe49979f291ef1ef8fbc2d7f99a8270b9 (diff)
downloadrt.equinox.framework-b02f5f661385ce014acdb16681458e600580e643.tar.gz
rt.equinox.framework-b02f5f661385ce014acdb16681458e600580e643.tar.xz
rt.equinox.framework-b02f5f661385ce014acdb16681458e600580e643.zip
Bug 415837 - Out of order locks for module state change lock can happen for unresolve and resolve
- Need prevent recursive start from resolve operation.
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java
index d6ab255c3..9aa2d8674 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java
@@ -157,6 +157,12 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
final ReentrantLock stateChangeLock = new ReentrantLock();
private final EnumSet<ModuleEvent> stateTransitionEvents = EnumSet.noneOf(ModuleEvent.class);
private final EnumSet<Settings> settings;
+ private final ThreadLocal<Boolean> inStartResolve = new ThreadLocal<Boolean>() {
+ @Override
+ protected Boolean initialValue() {
+ return Boolean.FALSE;
+ }
+ };
private volatile State state = State.INSTALLED;
private volatile int startlevel;
private volatile long lastModified;
@@ -395,8 +401,10 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
lockedStarted = false;
ModuleResolutionReport report;
try {
+ inStartResolve.set(Boolean.TRUE);
report = getRevisions().getContainer().resolve(Arrays.asList(this), true);
} finally {
+ inStartResolve.set(Boolean.FALSE);
lockStateChange(ModuleEvent.STARTED);
lockedStarted = true;
}
@@ -424,6 +432,7 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
event = ModuleEvent.STOPPED;
}
} finally {
+ inStartResolve.set(Boolean.FALSE);
if (lockedStarted) {
unlockStateChange(ModuleEvent.STARTED);
}
@@ -665,4 +674,8 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
ModuleRevision current = getCurrentRevision();
return current == null ? false : current.hasLazyActivatePolicy();
}
+
+ boolean inStartResolve() {
+ return inStartResolve.get().booleanValue();
+ }
}

Back to the top