Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-04-03 11:25:13 -0400
committerThomas Watson2014-04-03 11:25:13 -0400
commit848b9004c041433200cc93227ad95dafc1f83a82 (patch)
tree08401f9134393f91c3171d11a59e47021590617d
parent217853bb6600317f28b76dd7c6521a626435f2a4 (diff)
downloadrt.equinox.framework-848b9004c041433200cc93227ad95dafc1f83a82.tar.gz
rt.equinox.framework-848b9004c041433200cc93227ad95dafc1f83a82.tar.xz
rt.equinox.framework-848b9004c041433200cc93227ad95dafc1f83a82.zip
Bug 431491 - Debug tracing option to print stacktrace when bundle is
lazy-loaded
-rw-r--r--bundles/org.eclipse.osgi/.options28
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java9
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/Debug.java7
4 files changed, 25 insertions, 29 deletions
diff --git a/bundles/org.eclipse.osgi/.options b/bundles/org.eclipse.osgi/.options
index 86e00f286..4d11b57c8 100644
--- a/bundles/org.eclipse.osgi/.options
+++ b/bundles/org.eclipse.osgi/.options
@@ -58,30 +58,8 @@ org.eclipse.osgi/resolver/report = false
#### Monitoring settings
-# monitor class loading
-org.eclipse.osgi/monitor/classes=false
-# monitor bundle activation
+# monitor eager bundle activation
org.eclipse.osgi/monitor/activation=false
-
-# monitor resource bundle (*.properties) loading
-org.eclipse.osgi/monitor/resources=false
-
-
-#### Trace settings
-# trace class loading - snapshot the execution stack when a class is loaded
-org.eclipse.osgi/trace/classLoading=false
-
-# trace location - file in which execution traces are written
-org.eclipse.osgi/trace/filename=runtime.traces
-
-# trace filters - Java properties file defining which classes should
-# be traced (if trace/classLoading is true)
-# File format:
-# plugins=<comma separated list of plugins whose classes to trace>
-# packages=<comma separated list of package prefixes of classes to trace>
-# Note that there may be many 'plugins' and 'packages' lines in one file.
-org.eclipse.osgi/trace/filters=trace.properties
-
-# trace bundle activation - snapshot the execution stack when a bundle is activated
-org.eclipse.osgi/trace/activation=false
+# monitor lazy bundle activation
+org.eclipse.osgi/monitor/lazy=false
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 50e42e582..633fbf41f 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
@@ -15,6 +15,7 @@ import java.util.EnumSet;
import java.util.concurrent.TimeUnit;
import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent;
import org.eclipse.osgi.internal.container.EquinoxReentrantLock;
+import org.eclipse.osgi.internal.debug.Debug;
import org.eclipse.osgi.internal.messages.Msg;
import org.eclipse.osgi.report.resolution.ResolutionReport;
import org.osgi.framework.*;
@@ -212,7 +213,7 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
* Returns the module container this module is contained in.
* @return the module container.
*/
- public ModuleContainer getContainer() {
+ public final ModuleContainer getContainer() {
return revisions.getContainer();
}
@@ -544,6 +545,9 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
}
// continue on to normal starting
}
+ if (getContainer().DEBUG_MONITOR_LAZY) {
+ Debug.printStackTrace(new Exception("Module is being lazy activated: " + this)); //$NON-NLS-1$
+ }
} else {
if (isLazyActivate(options) && !isTriggerSet()) {
if (State.LAZY_STARTING.equals(getState())) {
@@ -684,12 +688,12 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
return hasLazyActivatePolicy();
}
- boolean hasLazyActivatePolicy() {
+ final boolean hasLazyActivatePolicy() {
ModuleRevision current = getCurrentRevision();
return current == null ? false : current.hasLazyActivatePolicy();
}
- boolean inStartResolve() {
+ final boolean inStartResolve() {
return inStartResolve.get().booleanValue();
}
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
index 6d619fdf4..2c73e63fe 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
@@ -92,6 +92,8 @@ public final class ModuleContainer implements DebugOptionsListener {
private final long moduleLockTimeout;
+ boolean DEBUG_MONITOR_LAZY = false;
+
/**
* Constructs a new container with the specified adaptor, module database.
* @param adaptor the adaptor for the container
@@ -117,6 +119,10 @@ public final class ModuleContainer implements DebugOptionsListener {
}
}
this.moduleLockTimeout = tempModuleLockTimeout;
+ DebugOptions debugOptions = adaptor.getDebugOptions();
+ if (debugOptions != null) {
+ this.DEBUG_MONITOR_LAZY = debugOptions.getBooleanOption(Debug.OPTION_MONITOR_LAZY, false);
+ }
}
/**
@@ -1369,6 +1375,9 @@ public final class ModuleContainer implements DebugOptionsListener {
public void optionsChanged(DebugOptions options) {
moduleResolver.setDebugOptions();
frameworkStartLevel.setDebugOptions();
+ if (options != null) {
+ this.DEBUG_MONITOR_LAZY = options.getBooleanOption(Debug.OPTION_MONITOR_LAZY, false);
+ }
}
class ContainerStartLevel implements FrameworkStartLevel, EventDispatcher<Module, FrameworkListener[], Integer> {
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 565ee1e1a..6f44af8c5 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
@@ -79,6 +79,11 @@ public class Debug implements DebugOptionsListener {
* Monitor activation Debug option key.
*/
public static final String OPTION_MONITOR_ACTIVATION = ECLIPSE_OSGI + "/monitor/activation"; //$NON-NLS-1$
+
+ /**
+ * Monitor lazy activation Debug option key
+ */
+ public static final String OPTION_MONITOR_LAZY = ECLIPSE_OSGI + "/monitor/lazy"; //$NON-NLS-1$
/**
* Message bundles Debug option key.
*/
@@ -145,7 +150,7 @@ public class Debug implements DebugOptionsListener {
/**
* Monitor activation debug flag.
*/
- public boolean MONITOR_ACTIVATION = false; // "monitor/bundles"
+ public boolean MONITOR_ACTIVATION = false; // "monitor/activation"
public boolean DEBUG_LOCATION = false; // debug/location

Back to the top