diff options
author | Thomas Watson | 2015-07-29 12:53:55 +0000 |
---|---|---|
committer | Thomas Watson | 2015-07-29 12:53:55 +0000 |
commit | fc62fed82eceef66aaf1a12b053f9c49ff4a0f54 (patch) | |
tree | 077dcd585246e4384b60aea8848b2d260e58d016 | |
parent | 34c746f3fd5b08f2b8eb01e75f59ccd2e3f4c6f0 (diff) | |
download | rt.equinox.framework-fc62fed82eceef66aaf1a12b053f9c49ff4a0f54.tar.gz rt.equinox.framework-fc62fed82eceef66aaf1a12b053f9c49ff4a0f54.tar.xz rt.equinox.framework-fc62fed82eceef66aaf1a12b053f9c49ff4a0f54.zip |
Bug 473216 - Add trace option to log call stack of the system bundle stop()
3 files changed, 23 insertions, 6 deletions
diff --git a/bundles/org.eclipse.osgi/.options b/bundles/org.eclipse.osgi/.options index 4d11b57c8..84b09b61d 100644 --- a/bundles/org.eclipse.osgi/.options +++ b/bundles/org.eclipse.osgi/.options @@ -30,6 +30,8 @@ org.eclipse.osgi/debug/objectPool/adds=false org.eclipse.osgi/debug/objectPool/dups=false # Debug the caching of bundle headers org.eclipse.osgi/debug/cachedmanifest = false +# Debug the lifecycle operations of the framework/systemBundle +org.eclipse.osgi/debug/systemBundle=false # Eclipse adaptor options org.eclipse.osgi/eclipseadaptor/debug = false diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/Debug.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/Debug.java index 6f44af8c5..ee0e69d63 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/Debug.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/Debug.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2014 IBM Corporation and others. + * Copyright (c) 2003, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -93,6 +93,8 @@ public class Debug implements DebugOptionsListener { public static final String OPTION_CACHED_MANIFEST = ECLIPSE_OSGI + "/debug/cachedmanifest"; //$NON-NLS-1$ + public static final String OPTION_DEBUG_SYSTEM_BUNDLE = ECLIPSE_OSGI + "/debug/systemBundle"; //$NON-NLS-1$ + /** * General debug flag. */ @@ -156,6 +158,8 @@ public class Debug implements DebugOptionsListener { public boolean DEBUG_CACHED_MANIFEST = false; + public boolean DEBUG_SYSTEM_BUNDLE = false; // debug/systemBundle + public Debug(DebugOptions dbgOptions) { optionsChanged(dbgOptions); } @@ -180,6 +184,7 @@ public class Debug implements DebugOptionsListener { MONITOR_ACTIVATION = dbgOptions.getBooleanOption(OPTION_MONITOR_ACTIVATION, false); DEBUG_LOCATION = dbgOptions.getBooleanOption(OPTION_DEBUG_LOCATION, false); DEBUG_CACHED_MANIFEST = dbgOptions.getBooleanOption(OPTION_CACHED_MANIFEST, false); + DEBUG_SYSTEM_BUNDLE = dbgOptions.getBooleanOption(OPTION_DEBUG_SYSTEM_BUNDLE, false); } /** diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java index eacfcbc6d..8981c8697 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 IBM Corporation and others. + * Copyright (c) 2012, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,10 +19,7 @@ import java.util.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.eclipse.osgi.container.*; -import org.eclipse.osgi.container.Module.Settings; -import org.eclipse.osgi.container.Module.StartOptions; -import org.eclipse.osgi.container.Module.State; -import org.eclipse.osgi.container.Module.StopOptions; +import org.eclipse.osgi.container.Module.*; import org.eclipse.osgi.container.ModuleContainerAdaptor.ContainerEvent; import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent; import org.eclipse.osgi.framework.eventmgr.EventDispatcher; @@ -147,6 +144,9 @@ public class EquinoxBundle implements Bundle, BundleReference { } void asyncStop() throws BundleException { + if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) { + Debug.printStackTrace(new Exception("Framework has been requested to stop.")); //$NON-NLS-1$ + } lockStateChange(ModuleEvent.STOPPED); try { if (Module.ACTIVE_SET.contains(getState())) { @@ -170,6 +170,9 @@ public class EquinoxBundle implements Bundle, BundleReference { } void asyncUpdate() throws BundleException { + if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) { + Debug.printStackTrace(new Exception("Framework has been requested to update (restart).")); //$NON-NLS-1$ + } lockStateChange(ModuleEvent.UPDATED); try { if (Module.ACTIVE_SET.contains(getState())) { @@ -202,7 +205,14 @@ public class EquinoxBundle implements Bundle, BundleReference { public void init(FrameworkListener... listeners) throws BundleException { if (listeners != null) { + if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) { + Debug.println("Initializing framework with framework listeners: " + listeners); //$NON-NLS-1$ + } initListeners.addAll(Arrays.asList(listeners)); + } else { + if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) { + Debug.println("Initializing framework with framework no listeners"); //$NON-NLS-1$ + } } try { ((SystemModule) getModule()).init(); |