• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

reload tomcat context programmatically whenever java heap memory exception occurs

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat Manager web app allows me to easily restart a web app.
So,when I got the exception like Java heap memory problem, I wanted to restart the context(or call the manager URL) programmatically.
In between any request comes to server(context) will hold up to the completion of the context restart then after process that request.

Can you guide me how to achieve the above scenario.



Thanks,
Maria.

 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the "Out of memory error" is not meant to be caught neither the JVM will be running after this error occurs. Tomcat and JVM both will be going down. So there is no way to reload the context, to be specific store the context for later reload.
If you want to queue requests when the application is down, then my guess is you need another load balancing server or a queuing server simply because the current server is not able to bear with the load its working with.

Hope this helps
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably not a good idea to try to recover from a memory exception by any shortcut - you need to restart the server.

Naturally figuring out why you got the exception and fixing it is the best long term plan.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!