• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stopping Server or System Shutdown Handeling

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic