Skip to content

Commit

Permalink
restore previous code which fail with 3.8.2 staged
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Lamy <olamy@apache.org>
  • Loading branch information
olamy committed Aug 11, 2021
1 parent 08ec1d4 commit cd954db
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,20 +231,24 @@ public void execute() throws MojoExecutionException, MojoFailureException
// Get some random free port
port = findRandomOpenPortOnAllLocalInterfaces();
}
ClassLoader ori = Thread.currentThread().getContextClassLoader();
runner = new Thread(() ->
{
try
{
Thread.currentThread().setContextClassLoader(getClassLoader());
Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(mainClass);
Method main = clazz.getMethod("main", String[].class);
main.invoke(null, (Object) new String[] {String.valueOf(port) });
}
catch (Throwable e)
{
error.set(e);
} finally
{
Thread.currentThread().setContextClassLoader(ori);
}
});
runner.setContextClassLoader(getClassLoader());
runner.setDaemon(true);
runner.start();
try
Expand Down

0 comments on commit cd954db

Please sign in to comment.