• 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

preStop() not called when weblogic process killed

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a class which extends weblogic.application.ApplicationLifecycleListener.

I write some resource cleanup code in the
public void preStop(ApplicationLifecycleEvent evt){
// call some other class and release some resources
}
Now, the problem is if I shutdown my weblogic using the shutdown script, the preStop method gets called and my clean up code gets executed and everything is fine.
But, if the weblogic process is killed using the "kill" cmd then the preStop method is not called.
I guess even if I implement shutdown classes, it will act the same way. Is that right?
How can I ensure that even if the Weblogic process is killed , then also my clean up code (i.e. a method which has my clean up code) should run? How do I implement that?
Any help will be really appreciated.

PS: I can't ensure that the kill command is never used as the server maintenance lies with a different team :-(.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is probably nothing you can do to get your preStop() method to run if someone forcefully kills the WebLogic process.

You should educate the system administrators that they should never forcefully kill WebLogic, and you should design your software so that it isn't left in a corrupt state whenever it's killed forcefully.

Suppose someone pulls the power plug from the server. There's absolutely no way you can get your preStop() method run when something like that happens. The only thing you can do is make your application robust so that it doesn't get into a corrupt state when something like that happens.
[ July 18, 2008: Message edited by: Jesper Young ]
reply
    Bookmark Topic Watch Topic
  • New Topic