448446 - org.eclipse.jetty.start.Main create classloader duplicate

+ Reuse ClassLoader instead.
This commit is contained in:
Joakim Erdfelt 2014-11-04 15:03:46 -07:00
parent 5d0595cabd
commit 04fc803b0e
1 changed files with 3 additions and 6 deletions

View File

@ -289,10 +289,9 @@ public class Main
return "";
}
public void invokeMain(StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, IOException
public void invokeMain(ClassLoader classloader, StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, IOException
{
Class<?> invoked_class = null;
ClassLoader classloader = args.getClasspath().getClassLoader();
String mainclass = args.getMainClassname();
try
@ -317,8 +316,7 @@ public class Main
{ argArray.getClass() };
Method main = invoked_class.getDeclaredMethod("main",method_param_types);
Object[] method_params = new Object[]
{ argArray };
Object[] method_params = new Object[] { argArray };
StartLog.endStartLog();
main.invoke(null,method_params);
}
@ -810,14 +808,13 @@ public class Main
System.err.println("WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec");
}
// Set current context class loader to what is selected.
ClassLoader cl = classpath.getClassLoader();
Thread.currentThread().setContextClassLoader(cl);
// Invoke the Main Class
try
{
invokeMain(args);
invokeMain(cl, args);
}
catch (Exception e)
{