My Project is a web based project with JSP and Servlet Technologies hosted by a JBoss Server.
In my application ,there is a option where user can call a exe run a separate application.
Is there any way in case the System is shut down or App Server is Restarted in that case a stop method should be invoked to
Stop the invoked process and clear certain Files from a location.
Is the Process spawned off by a call to Runtime.exec()?
If yes,
1. store a handle to the Process object in your context scope. I
2. Implement the ServletContextListener interface which listens for lifecycle methods (start and shutdown of the web application).
3. In the contextDestroyed() method of the ServletContextListener, retrieve the process object and call destroy() on it.
ram.
Note : The runtime.exec() may not work well dependning on the platform and the kind of process you spawn. Read the javadoc to understand the limitations.
subject: Stopping Server or System Shutdown Handeling