Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java')
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java
index 5ecc3e39a..64425f045 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java
@@ -356,7 +356,7 @@ public class StartLevelManager implements EventDispatcher, EventListener, StartL
* <tt>AdminPermission</tt> and the Java runtime environment supports
* permissions.
*/
- public void setBundleStartLevel(org.osgi.framework.Bundle bundle, int newSL) {
+ public void setBundleStartLevel(Bundle bundle, int newSL) {
String exceptionText = null;
if (bundle.getBundleId() == 0) { // system bundle has id=0
@@ -372,7 +372,8 @@ public class StartLevelManager implements EventDispatcher, EventListener, StartL
framework.checkAdminPermission(bundle, AdminPermission.EXECUTE);
try {
// if the bundle's startlevel is not already at the requested startlevel
- if (newSL != ((org.eclipse.osgi.framework.internal.core.AbstractBundle) bundle).getStartLevel()) {
+ int oldSL = ((AbstractBundle) bundle).getStartLevel();
+ if (newSL != oldSL) {
final AbstractBundle b = (AbstractBundle) bundle;
b.getBundleData().setStartLevel(newSL);
try {
@@ -389,7 +390,9 @@ public class StartLevelManager implements EventDispatcher, EventListener, StartL
throw (RuntimeException) e.getException();
}
// handle starting or stopping the bundle asynchronously
- issueEvent(new StartLevelEvent(StartLevelEvent.CHANGE_BUNDLE_SL, newSL, (AbstractBundle) bundle));
+ if (newSL > oldSL || !((AbstractBundle) bundle).isActive())
+ // only need to do this if the newSL > oldSL (stopping) or the bundle is not active (could activate)
+ issueEvent(new StartLevelEvent(StartLevelEvent.CHANGE_BUNDLE_SL, newSL, (AbstractBundle) bundle));
}
} catch (IOException e) {
framework.publishFrameworkEvent(FrameworkEvent.ERROR, bundle, e);

Back to the top