I have a web application made with Spring that runs on Tomcat. On the same machine there is a normal Java application.
I would like to execute the Java application by calling it from the web server, but i want to make it so the application won’t use the server’s resources (it involves the training of a classifier so it may take up a lot of resources and time) and it must not hang the server (so it must be called asynchronously).
Is there any way to do that?
You have two options.
Start a separate JVM instance by doing a
execand using ajavacommand.Spawn a new thread – this will use server’s resources though.
You can also combine options 1 and 2 and create a thread that does the
execcall.