Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Marschall2015-04-11 13:03:01 +0000
committerGreg Wilkins2015-04-22 06:28:37 +0000
commitfb58ca79c0df74a6450d2217a09f6aab4d4e044c (patch)
treef193316f61242a2dcef179afa4cac26c81b3c59c /jetty-webapp
parenteee2a531978c798d49c94562acca4a07be6cfd5f (diff)
downloadorg.eclipse.jetty.project-fb58ca79c0df74a6450d2217a09f6aab4d4e044c.tar.gz
org.eclipse.jetty.project-fb58ca79c0df74a6450d2217a09f6aab4d4e044c.tar.xz
org.eclipse.jetty.project-fb58ca79c0df74a6450d2217a09f6aab4d4e044c.zip
Bug 464442 - Enable parallel class loading
Change-Id: If23cc99214efe8d3a75d0ab0d337020524b6709f Signed-off-by: Philippe Marschall <philippe.marschall@netcetera.ch>
Diffstat (limited to 'jetty-webapp')
-rw-r--r--jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java90
1 files changed, 49 insertions, 41 deletions
diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java
index 0bd3d9396d..337a32e3fb 100644
--- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java
+++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java
@@ -65,6 +65,11 @@ import org.eclipse.jetty.util.resource.ResourceCollection;
*/
public class WebAppClassLoader extends URLClassLoader
{
+ static
+ {
+ registerAsParallelCapable();
+ }
+
private static final Logger LOG = Log.getLogger(WebAppClassLoader.class);
private final Context _context;
@@ -404,60 +409,63 @@ public class WebAppClassLoader extends URLClassLoader
/* ------------------------------------------------------------ */
@Override
- protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
+ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
{
- Class<?> c= findLoadedClass(name);
- ClassNotFoundException ex= null;
- boolean tried_parent= false;
-
- boolean system_class=_context.isSystemClass(name);
- boolean server_class=_context.isServerClass(name);
-
- if (system_class && server_class)
- {
- return null;
- }
-
- if (c == null && _parent!=null && (_context.isParentLoaderPriority() || system_class) && !server_class)
+ synchronized (getClassLoadingLock(name))
{
- tried_parent= true;
- try
- {
- c= _parent.loadClass(name);
- if (LOG.isDebugEnabled())
- LOG.debug("loaded " + c);
- }
- catch (ClassNotFoundException e)
+ Class<?> c= findLoadedClass(name);
+ ClassNotFoundException ex= null;
+ boolean tried_parent= false;
+
+ boolean system_class=_context.isSystemClass(name);
+ boolean server_class=_context.isServerClass(name);
+
+ if (system_class && server_class)
{
- ex= e;
+ return null;
}
- }
- if (c == null)
- {
- try
+ if (c == null && _parent!=null && (_context.isParentLoaderPriority() || system_class) && !server_class)
{
- c= this.findClass(name);
+ tried_parent= true;
+ try
+ {
+ c= _parent.loadClass(name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("loaded " + c);
+ }
+ catch (ClassNotFoundException e)
+ {
+ ex= e;
+ }
}
- catch (ClassNotFoundException e)
+
+ if (c == null)
{
- ex= e;
+ try
+ {
+ c= this.findClass(name);
+ }
+ catch (ClassNotFoundException e)
+ {
+ ex= e;
+ }
}
- }
- if (c == null && _parent!=null && !tried_parent && !server_class )
- c= _parent.loadClass(name);
+ if (c == null && _parent!=null && !tried_parent && !server_class )
+ c= _parent.loadClass(name);
- if (c == null && ex!=null)
- throw ex;
+ if (c == null && ex!=null)
+ throw ex;
- if (resolve)
- resolveClass(c);
+ if (resolve)
+ resolveClass(c);
- if (LOG.isDebugEnabled())
- LOG.debug("loaded {} from {}",c,c==null?null:c.getClassLoader());
-
- return c;
+ if (LOG.isDebugEnabled())
+ LOG.debug("loaded {} from {}",c,c==null?null:c.getClassLoader());
+
+ return c;
+ }
}
/* ------------------------------------------------------------ */

Back to the top