JETTY-1250 set parallel context classloader and turn default off

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2468 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-11-04 02:08:18 +00:00
parent cc13688c69
commit c4da2ad0fe
1 changed files with 17 additions and 5 deletions

View File

@ -41,7 +41,7 @@ public class HandlerCollection extends AbstractHandlerContainer
{
private final boolean _mutableWhenRunning;
private volatile Handler[] _handlers;
private boolean _parallelStart=true;
private boolean _parallelStart=false;
/* ------------------------------------------------------------ */
public HandlerCollection()
@ -189,6 +189,7 @@ public class HandlerCollection extends AbstractHandlerContainer
if (_parallelStart)
{
final CountDownLatch latch = new CountDownLatch(_handlers.length);
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (int i=0;i<_handlers.length;i++)
{
final int h=i;
@ -197,13 +198,24 @@ public class HandlerCollection extends AbstractHandlerContainer
{
public void run()
{
try{_handlers[h].start();}
catch(Throwable e){mex.add(e);}
finally{latch.countDown();}
ClassLoader orig = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(loader);
_handlers[h].start();
}
catch(Throwable e)
{
mex.add(e);
}
finally
{
Thread.currentThread().setContextClassLoader(orig);
latch.countDown();
}
}
}
);
}
latch.await();
}