• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stopping Server or System Shutdown Handeling

 
abinash das
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks in advance.
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic