aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2010-06-10 04:56:26 (EDT)
committerGlyn Normington2010-06-10 04:56:26 (EDT)
commitf9a9b48abf05f74d7ebf129c92aa17d87308a35a (patch)
tree5174a92027b9ca38041c0955c3f083ed9b2f2994
parentbd485b41ef5d9c455a639401c982572716fc94a3 (diff)
downloadorg.eclipse.gemini.web.gemini-web-container-f9a9b48abf05f74d7ebf129c92aa17d87308a35a.zip
org.eclipse.gemini.web.gemini-web-container-f9a9b48abf05f74d7ebf129c92aa17d87308a35a.tar.gz
org.eclipse.gemini.web.gemini-web-container-f9a9b48abf05f74d7ebf129c92aa17d87308a35a.tar.bz2
bug 316405: avoid alien call to prevent deadlock
-rw-r--r--org.eclipse.gemini.web.extender/src/main/resources/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.gemini.web.extender/src/test/resources/META-INF/TEST.MF2
-rw-r--r--org.eclipse.gemini.web.test/src/test/resources/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/loading/ChainedClassLoader.java286
-rw-r--r--org.eclipse.gemini.web.tomcat/src/main/resources/META-INF/MANIFEST.MF28
-rw-r--r--org.eclipse.gemini.web.tomcat/src/test/resources/META-INF/TEST.MF2
m---------virgo-build0
7 files changed, 153 insertions, 176 deletions
diff --git a/org.eclipse.gemini.web.extender/src/main/resources/META-INF/MANIFEST.MF b/org.eclipse.gemini.web.extender/src/main/resources/META-INF/MANIFEST.MF
index bb3a46b..cbad3cf 100644
--- a/org.eclipse.gemini.web.extender/src/main/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.gemini.web.extender/src/main/resources/META-INF/MANIFEST.MF
@@ -1,12 +1,11 @@
Manifest-Version: 1
Export-Package: org.eclipse.gemini.web.extender;version="1";uses:="org
- .eclipse.gemini.web.core,org.osgi.framework,org.osgi.util.tracker"
+ .eclipse.gemini.web.core"
Bundle-Version: 1
Tool: Bundlor 1.0.0.M6
Bundle-Name: SpringSource OSGi Web Container Extender
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.gemini.web.extender.ExtenderActivator
Bundle-SymbolicName: org.eclipse.gemini.web.extender
-Import-Package: org.eclipse.gemini.web.core;version="1.0",org.osgi.fra
- mework;version="0",org.osgi.util.tracker;version="1.4.2"
+Import-Package: org.eclipse.gemini.web.core;version="1.0"
diff --git a/org.eclipse.gemini.web.extender/src/test/resources/META-INF/TEST.MF b/org.eclipse.gemini.web.extender/src/test/resources/META-INF/TEST.MF
index 38ab879..3ec0672 100644
--- a/org.eclipse.gemini.web.extender/src/test/resources/META-INF/TEST.MF
+++ b/org.eclipse.gemini.web.extender/src/test/resources/META-INF/TEST.MF
@@ -1,5 +1,3 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Import-Package: javax.servlet;version="2.5",junit.framework,org.eclips
- e.virgo.teststubs.osgi.framework,org.junit
diff --git a/org.eclipse.gemini.web.test/src/test/resources/META-INF/MANIFEST.MF b/org.eclipse.gemini.web.test/src/test/resources/META-INF/MANIFEST.MF
index 72c89fd..0528823 100644
--- a/org.eclipse.gemini.web.test/src/test/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.gemini.web.test/src/test/resources/META-INF/MANIFEST.MF
@@ -3,10 +3,6 @@ Bundle-Version: 1.0
Tool: Bundlor 1.0.0.M6
Bundle-Name: Web Container Tests
Bundle-ManifestVersion: 2
-Import-Package: javax.servlet;version="0",junit.framework;version="0",
- org.eclipse.gemini.web.core.spi;version="0",org.eclipse.virgo.test.fr
- amework;version="0",org.eclipse.virgo.util.io;version="0",org.junit;v
- ersion="0",org.junit.runner;version="0",org.osgi.framework;version="0
- "
+Import-Package: org.eclipse.gemini.web.core.spi;version="0"
Bundle-SymbolicName: org.eclipse.gemini.web.test
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/loading/ChainedClassLoader.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/loading/ChainedClassLoader.java
index 35a8ece..96866c3 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/loading/ChainedClassLoader.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/loading/ChainedClassLoader.java
@@ -23,151 +23,155 @@ import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Vector;
+/**
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * This class is immutable and therefore thread safe.
+ */
public final class ChainedClassLoader extends ClassLoader {
- /** list of loaders */
- private final List<ClassLoader> loaders = new ArrayList<ClassLoader>();
-
- /**
- * Constructs a new <code>ChainedClassLoader</code> instance.
- *
- * @param loaders array of non-null class loaders
- * @param parent parent class loader (can be null)
- */
- ChainedClassLoader(ClassLoader... loaders) {
-
- synchronized (this.loaders) {
- for (int i = 0; i < loaders.length; i++) {
- ClassLoader classLoader = loaders[i];
- addLoader(classLoader);
- }
- }
- }
-
- public static ChainedClassLoader create(final ClassLoader... loaders) {
- return AccessController.doPrivileged(new PrivilegedAction<ChainedClassLoader>() {
-
- public ChainedClassLoader run() {
- return new ChainedClassLoader(loaders);
- }
-
- });
- }
-
- @Override
- public URL getResource(final String name) {
- if (System.getSecurityManager() != null) {
- return AccessController.doPrivileged(new PrivilegedAction<URL>() {
-
- public URL run() {
- return doGetResource(name);
- }
- });
- } else {
- return doGetResource(name);
- }
- }
-
- @Override
- public Enumeration<URL> getResources(final String name) throws IOException {
- if (System.getSecurityManager() != null) {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<Enumeration<URL>>() {
-
- public Enumeration<URL> run() throws Exception {
- return doGetResources(name);
- }
-
- });
- } catch (PrivilegedActionException e) {
- Exception exception = e.getException();
- if (exception instanceof RuntimeException) {
- throw (RuntimeException) exception;
- } else if (exception instanceof IOException) {
- throw (IOException) exception;
- } else {
- throw new IllegalStateException("Unexpected Exception from privileged action.", exception);
- }
- }
- } else {
- return doGetResources(name);
- }
- }
-
- private Enumeration<URL> doGetResources(String name) throws IOException {
- Vector<URL> urls = new Vector<URL>();
- synchronized (this.loaders) {
- for (ClassLoader loader : this.loaders) {
- Enumeration<URL> resources = loader.getResources(name);
- if (resources != null) {
- while (resources.hasMoreElements()) {
- URL url = (URL) resources.nextElement();
- urls.add(url);
- }
- }
- }
- }
- return urls.elements();
- }
-
- private URL doGetResource(String name) {
- URL url = null;
- synchronized (loaders) {
- for (int i = 0; i < loaders.size(); i++) {
- ClassLoader loader = (ClassLoader) loaders.get(i);
- url = loader.getResource(name);
- if (url != null)
- return url;
- }
- }
- return url;
- }
-
- public Class<?> loadClass(final String name) throws ClassNotFoundException {
-
- if (System.getSecurityManager() != null) {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
-
- public Class<?> run() throws Exception {
- return doLoadClass(name);
- }
- });
- } catch (PrivilegedActionException pae) {
- throw (ClassNotFoundException) pae.getException();
- }
- } else {
- return doLoadClass(name);
- }
- }
-
- private Class<?> doLoadClass(String name) throws ClassNotFoundException {
- Class<?> clazz = null;
-
- synchronized (loaders) {
- for (int i = 0; i < loaders.size(); i++) {
- ClassLoader loader = (ClassLoader) loaders.get(i);
- try {
- clazz = loader.loadClass(name);
- return clazz;
- } catch (ClassNotFoundException e) {
- // keep moving through the class loaders
- }
- }
- }
-
- throw new ClassNotFoundException(name);
- }
-
- private void addLoader(ClassLoader classLoader) {
- synchronized (loaders) {
- if (!loaders.contains(classLoader)) {
- loaders.add(classLoader);
- }
- }
- }
+ /** list of loaders */
+ private final List<ClassLoader> loaders;
+
+ /**
+ * Constructs a new <code>ChainedClassLoader</code> instance.
+ *
+ * @param loaders
+ * array of non-null class loaders
+ * @param parent
+ * parent class loader (can be null)
+ */
+ ChainedClassLoader(ClassLoader... loaders) {
+
+ List<ClassLoader> l = new ArrayList<ClassLoader>();
+
+ for (int i = 0; i < loaders.length; i++) {
+ ClassLoader classLoader = loaders[i];
+ if (!l.contains(classLoader)) {
+ l.add(classLoader);
+ }
+ }
+
+ this.loaders = Collections.unmodifiableList(l);
+ }
+
+ public static ChainedClassLoader create(final ClassLoader... loaders) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<ChainedClassLoader>() {
+
+ public ChainedClassLoader run() {
+ return new ChainedClassLoader(loaders);
+ }
+
+ });
+ }
+
+ @Override
+ public URL getResource(final String name) {
+ if (System.getSecurityManager() != null) {
+ return AccessController.doPrivileged(new PrivilegedAction<URL>() {
+
+ public URL run() {
+ return doGetResource(name);
+ }
+ });
+ } else {
+ return doGetResource(name);
+ }
+ }
+
+ @Override
+ public Enumeration<URL> getResources(final String name) throws IOException {
+ if (System.getSecurityManager() != null) {
+ try {
+ return AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Enumeration<URL>>() {
+
+ public Enumeration<URL> run() throws Exception {
+ return doGetResources(name);
+ }
+
+ });
+ } catch (PrivilegedActionException e) {
+ Exception exception = e.getException();
+ if (exception instanceof RuntimeException) {
+ throw (RuntimeException) exception;
+ } else if (exception instanceof IOException) {
+ throw (IOException) exception;
+ } else {
+ throw new IllegalStateException(
+ "Unexpected Exception from privileged action.",
+ exception);
+ }
+ }
+ } else {
+ return doGetResources(name);
+ }
+ }
+
+ private Enumeration<URL> doGetResources(String name) throws IOException {
+ Vector<URL> urls = new Vector<URL>();
+ for (ClassLoader loader : this.loaders) {
+ Enumeration<URL> resources = loader.getResources(name);
+ if (resources != null) {
+ while (resources.hasMoreElements()) {
+ URL url = (URL) resources.nextElement();
+ urls.add(url);
+ }
+ }
+ }
+ return urls.elements();
+ }
+
+ private URL doGetResource(String name) {
+ URL url = null;
+ for (int i = 0; i < loaders.size(); i++) {
+ ClassLoader loader = (ClassLoader) loaders.get(i);
+ url = loader.getResource(name);
+ if (url != null)
+ return url;
+ }
+ return url;
+ }
+
+ public Class<?> loadClass(final String name) throws ClassNotFoundException {
+
+ if (System.getSecurityManager() != null) {
+ try {
+ return AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
+
+ public Class<?> run() throws Exception {
+ return doLoadClass(name);
+ }
+ });
+ } catch (PrivilegedActionException pae) {
+ throw (ClassNotFoundException) pae.getException();
+ }
+ } else {
+ return doLoadClass(name);
+ }
+ }
+
+ private Class<?> doLoadClass(String name) throws ClassNotFoundException {
+ Class<?> clazz = null;
+
+ for (int i = 0; i < loaders.size(); i++) {
+ ClassLoader loader = (ClassLoader) loaders.get(i);
+ try {
+ clazz = loader.loadClass(name);
+ return clazz;
+ } catch (ClassNotFoundException e) {
+ // keep moving through the class loaders
+ }
+ }
+
+ throw new ClassNotFoundException(name);
+ }
+
}
diff --git a/org.eclipse.gemini.web.tomcat/src/main/resources/META-INF/MANIFEST.MF b/org.eclipse.gemini.web.tomcat/src/main/resources/META-INF/MANIFEST.MF
index 4c796d2..55fcd80 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.gemini.web.tomcat/src/main/resources/META-INF/MANIFEST.MF
@@ -1,6 +1,5 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.gemini.web.tomcat.spi;version="1";uses:="o
- rg.osgi.framework"
+Export-Package: org.eclipse.gemini.web.tomcat.spi;version="1"
Bundle-Version: 1
Tool: Bundlor 1.0.0.M6
Bundle-Name: SpringSource OSGi Web Container Tomcat Bootstrap
@@ -8,25 +7,8 @@ Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.gemini.web.tomcat.internal.Activator
Bundle-SymbolicName: org.eclipse.gemini.web.tomcat
Import-Package: javax.management;version="0",javax.naming;version="0",
- javax.naming.directory;version="0",javax.servlet;version="2.5",org.ap
- ache.catalina;version="6.0.20.S2-r5956",org.apache.catalina.connector
- ;version="6.0.20.S2-r5956",org.apache.catalina.core;version="6.0.20.S
- 2-r5956",org.apache.catalina.deploy;version="6.0.20.S2-r5956",org.apa
- che.catalina.startup;version="6.0.20.S2-r5956",org.apache.catalina.ut
- il;version="6.0.20.S2-r5956",org.apache.juli.logging;version="6.0.20.
- S2-r5956",org.apache.naming;version="6.0.20.S2-r5956",org.apache.nami
- ng.resources;version="6.0.20.S2-r5956",org.apache.tomcat;version="6.0
- .20.S2-r5956",org.apache.tomcat.util;version="6.0.20.S2-r5956",org.ap
- ache.tomcat.util.digester;version="6.0.20.S2-r5956",org.apache.tomcat
- .util.modeler;version="6.0.20.S2-r5956",org.eclipse.gemini.web.core;v
- ersion="1.0",org.eclipse.gemini.web.core.spi;version="1.0",org.eclips
- e.osgi.baseadaptor;version="0";resolution:="optional",org.eclipse.osg
- i.baseadaptor.bundlefile;version="0";resolution:="optional",org.eclip
- se.osgi.framework.adaptor;version="0";resolution:="optional",org.ecli
- pse.osgi.framework.internal.core;version="0";resolution:="optional",o
- rg.eclipse.virgo.util.io;version="2.0",org.eclipse.virgo.util.osgi;ve
- rsion="2.0",org.osgi.framework;version="0",org.osgi.service.packagead
- min;version="1.0",org.osgi.service.url;version="1.0",org.osgi.util.tr
- acker;version="1.4.2",org.slf4j;version="1.5.10",org.springframework.
- osgi.util;version="1.2.0",org.xml.sax;version="0"
+ javax.naming.directory;version="0",org.apache.catalina.deploy;version
+ ="6.0.20.S2-r5956",org.apache.juli.logging;version="6.0.20.S2-r5956",
+ org.eclipse.gemini.web.core;version="1.0",org.eclipse.gemini.web.core
+ .spi;version="1.0"
diff --git a/org.eclipse.gemini.web.tomcat/src/test/resources/META-INF/TEST.MF b/org.eclipse.gemini.web.tomcat/src/test/resources/META-INF/TEST.MF
index bf010d6..3ec0672 100644
--- a/org.eclipse.gemini.web.tomcat/src/test/resources/META-INF/TEST.MF
+++ b/org.eclipse.gemini.web.tomcat/src/test/resources/META-INF/TEST.MF
@@ -1,5 +1,3 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Import-Package: org.easymock,org.eclipse.virgo.teststubs.osgi.framewor
- k,org.junit
diff --git a/virgo-build b/virgo-build
-Subproject 5a215bb9062764bba1f420d70d0531cb47e3b7c
+Subproject 84c9bb92826f87e37a9ba2d2831d5851b5ce9de