Did you try the __del__() function?
The problem is that servlets are re-used, as Geoff mentioned. They're
not destructed after they run. Even if __del__ works, it won't
necessarily work the way that you want.
If you just want to explicitly shut down the database connection, you'll
have to wait for the stop of the AppServer, or rig-up your own
"grab-and-let-go" system to handle the database connections. Even if you
don't want to close them during sleep(), you could let go of them and
return them to a pool.
Meh Lounge wrote:
>I don't want to reopen database connection upon every
>request, it is too time-consuming, I just want to be
>sure that my database is intact when I shut down my
>server. Java servlet use destructor for that.
>I'll use shutdownhandler...