This week's book giveaway is in the Java in General forum. We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line! See this thread for details.
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()?
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.
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.