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