Hi All, I am facing a problem regarding abnormal termination of java program.When some one destroys a java program process from task manager, i need to modify something in the DB.I want to know what method is called when the program is about to exit abnormally. regards, Sumit
Take a look at the API docs for Runtime.addShutdownHook(Thread hook). That may serve your puprose. Pay particular attention to this: Shutdown hooks should also finish their work quickly. When a program invokes exit the expectation is that the virtual machine will promptly shut down and exit. When the virtual machine is terminated due to user logoff or system shutdown the underlying operating system may only allow a fixed amount of time in which to shut down and exit. It is therefore inadvisable to attempt any user interaction or to perform a long-running computation in a shutdown hook.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher