java automatic shut down

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashokformac
    New Member
    • Mar 2007
    • 16

    #1

    java automatic shut down

    when my java program shutdowns automatically or shutdowns when the system shut downs or or when systems crashes ,,, i want to perform some actions like updating database....

    how can i do this ...

    thanks in advance ...
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by ashokformac
    when my java program shutdowns automatically or shutdowns when the system shut downs or or when systems crashes ,,, i want to perform some actions like updating database....

    how can i do this ...

    thanks in advance ...
    A bit of advice: when your OS is actually crashing it is safest not to try to
    shutdown anything properly because your OS has turned into a raving
    lunatic and most likely won't flush buffers for you nor shut files etc. etc.
    Just let it die a horrible death. In all other cases have a look at the class
    Runtime and pay special attention to its methods getRuntime()
    and addShutdownHook ()

    kind regards,

    Jos

    Comment

    Working...