Subject Re: [Firebird-Java] Disconnect gracefully in Java console app
Author Thomas Steinmaurer
Hello Roman,

>> What's the easiest way to disconnect a database connection when I stop
>> my Java application? Some kind of callback?
>
> You can register your shutdown hook in JVM. It is an initialized, but
> not yet started thread that has to perform the cleanup task. For
> example, it can set some flag which will be checked by the thread that
> runs the main loop and will wait until the thread completes.
>
> See documentation to java.lang.Runtime.addShutdownHook(Thread) method.

A nice and clean way. Thanks for the pointer!!!


Regards,
Thomas