My application generates java code during runtime and compiles it using the JavaCompiler API. Some of the generated files can be rather large - up to a few hundred thousand lines. I find that when I run the javac
command on the generated code in the command line, or alternatively if I use an application that does just the compilation via the JavaCompiler API, I can compile many of these files (~500), even if they are very large, in under two minutes. However, if I call the API via my application when it is running on a Tomcat server, the compilation time runs upwards of twelve minutes (!!!).
I would appreciate any suggestions on how to improve the performance of the compilation.
Thanks!
Try to set the thread priority to the highest value (on the thread or thread pool):
setPriority(Thread.MAX_PRIORITY);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With