Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-02-25 14:55:21 +0000
committerThomas Watson2014-02-26 13:31:05 +0000
commit8b0c45ec585392556c01c38b42e7f63c6a023291 (patch)
tree775db9c25ed0c5503c8ee81b57be8fa1240d2009
parentf78c54e2acf9807394aba6908dd24897e619617d (diff)
downloadrt.equinox.framework-8b0c45ec585392556c01c38b42e7f63c6a023291.tar.gz
rt.equinox.framework-8b0c45ec585392556c01c38b42e7f63c6a023291.tar.xz
rt.equinox.framework-8b0c45ec585392556c01c38b42e7f63c6a023291.zip
Bug 429032 - Error message for timeout on lazy activation is missing thread information for lock owner
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java13
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/EquinoxReentrantLock.java24
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java6
3 files changed, 38 insertions, 5 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 d4b00fc4c..50e42e582 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
@@ -13,8 +13,8 @@ package org.eclipse.osgi.container;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent;
+import org.eclipse.osgi.internal.container.EquinoxReentrantLock;
import org.eclipse.osgi.internal.messages.Msg;
import org.eclipse.osgi.report.resolution.ResolutionReport;
import org.osgi.framework.*;
@@ -155,7 +155,7 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
private final Long id;
private final String location;
private final ModuleRevisions revisions;
- final ReentrantLock stateChangeLock = new ReentrantLock();
+ final EquinoxReentrantLock stateChangeLock = new EquinoxReentrantLock();
private final EnumSet<ModuleEvent> stateTransitionEvents = EnumSet.noneOf(ModuleEvent.class);
private final EnumSet<Settings> settings;
private final ThreadLocal<Boolean> inStartResolve = new ThreadLocal<Boolean>() {
@@ -357,6 +357,15 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
}
/**
+ * Returns the thread that currently owns the state change lock for this module, or
+ * <code>null</code> if not owned.
+ * @return the owner, or <code>null</code> if not owned.
+ */
+ public final Thread getStateChangeOwner() {
+ return stateChangeLock.getOwner();
+ }
+
+ /**
* Starts this module
* @param options the options for starting
* @throws BundleException if an errors occurs while starting
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/EquinoxReentrantLock.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/EquinoxReentrantLock.java
new file mode 100644
index 000000000..6d7fe0323
--- /dev/null
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/EquinoxReentrantLock.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osgi.internal.container;
+
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * This is just a ReentrantLock that makes getOwner a public methd
+ */
+public final class EquinoxReentrantLock extends ReentrantLock {
+ private static final long serialVersionUID = 1L;
+
+ final public Thread getOwner() {
+ return super.getOwner();
+ }
+}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java
index a736c3f9a..3f419d07c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2014 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
@@ -101,14 +101,14 @@ public class EclipseLazyStarter extends ClassLoaderHook {
// Note that another thread may already be starting this bundle;
// In this case we will timeout after a default of 5 seconds and record the BundleException
long startTime = System.currentTimeMillis();
+ Module m = managers[i].getGeneration().getRevision().getRevisions().getModule();
try {
// do not persist the start of this bundle
- Module m = managers[i].getGeneration().getRevision().getRevisions().getModule();
secureAction.start(m, StartOptions.LAZY_TRIGGER);
} catch (BundleException e) {
Bundle bundle = managers[i].getGeneration().getRevision().getBundle();
if (e.getType() == BundleException.STATECHANGE_ERROR) {
- String message = NLS.bind(Msg.ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP, new Object[] {Thread.currentThread(), name, null, bundle, new Long(System.currentTimeMillis() - startTime)});
+ String message = NLS.bind(Msg.ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP, new Object[] {Thread.currentThread(), name, m.getStateChangeOwner(), bundle, new Long(System.currentTimeMillis() - startTime)});
container.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.WARNING, message, e);
continue;
}

Back to the top