Bug 464442 - Enable parallel class loading

Change-Id: If23cc99214efe8d3a75d0ab0d337020524b6709f
Signed-off-by: Philippe Marschall <philippe.marschall@netcetera.ch>
This commit is contained in:
Philippe Marschall 2015-04-11 15:03:01 +02:00 committed by Greg Wilkins
parent eee2a53197
commit fb58ca79c0
2 changed files with 62 additions and 49 deletions

View File

@ -36,6 +36,11 @@ public class Classpath implements Iterable<File>
{ {
private static class Loader extends URLClassLoader private static class Loader extends URLClassLoader
{ {
static
{
registerAsParallelCapable();
}
Loader(URL[] urls, ClassLoader parent) Loader(URL[] urls, ClassLoader parent)
{ {
super(urls,parent); super(urls,parent);

View File

@ -65,6 +65,11 @@ import org.eclipse.jetty.util.resource.ResourceCollection;
*/ */
public class WebAppClassLoader extends URLClassLoader public class WebAppClassLoader extends URLClassLoader
{ {
static
{
registerAsParallelCapable();
}
private static final Logger LOG = Log.getLogger(WebAppClassLoader.class); private static final Logger LOG = Log.getLogger(WebAppClassLoader.class);
private final Context _context; private final Context _context;
@ -404,7 +409,9 @@ public class WebAppClassLoader extends URLClassLoader
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@Override @Override
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
{
synchronized (getClassLoadingLock(name))
{ {
Class<?> c= findLoadedClass(name); Class<?> c= findLoadedClass(name);
ClassNotFoundException ex= null; ClassNotFoundException ex= null;
@ -459,6 +466,7 @@ public class WebAppClassLoader extends URLClassLoader
return c; return c;
} }
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**