Remove use a separate runner thread from the Launcher

Previously, the Launcher was creating a new runner thread that would
call the application's main method. An exception thrown by this thread
is handled differently to one thrown by the JVM's main thread leading
to different exit behaviour. Furthermore, the separate thread isn't
actually necessary.

This commit removew the use of a separate runner thread from the
Launcher. This means that the JVM's exit behaviour will be consistent
and also removes the overhead of createing a starting an extra thread.

Closes gh-5006
This commit is contained in:
Andy Wilkinson 2016-02-04 14:15:49 +00:00
parent 8f57f4ca63
commit 9dbef5d9b0

View File

@ -97,10 +97,8 @@ public abstract class Launcher {
protected void launch(String[] args, String mainClass, ClassLoader classLoader)
throws Exception {
Runnable runner = createMainMethodRunner(mainClass, args, classLoader);
Thread runnerThread = new Thread(runner);
runnerThread.setContextClassLoader(classLoader);
runnerThread.setName(Thread.currentThread().getName());
runnerThread.start();
Thread.currentThread().setContextClassLoader(classLoader);
runner.run();
}
/**