Subject | Re: [Firebird-Java] Disconnect gracefully in Java console app |
---|---|
Author | Roman Rokytskyy |
Post date | 2008-01-18T12:48:18Z |
> What's the easiest way to disconnect a database connection when I stopYou can register your shutdown hook in JVM. It is an initialized, but
> my Java application? Some kind of callback?
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.
Roman