Hi,
I am using Derby DB in an embedded environment. I am shutting down the DB and
the system using the following two methods (I have ommitted all try-catch-
finally stuff, logging etc.)
Shutting down the DB, where fDS is an EmbeddedDataSource40:
public void shutdownDB() {
fDS.setShutdownDatabase("shutdown");
fDS.getConnection().close();
}
Shutting down the system:
public void shutdownDerby() {
DriverManager.getConnection("jdbc:derby:;shutdown=true");
}
This works, if it is done on the thread that is shutting down my OSGi
component, which encapsulates Derby, i.e. the deactivate-method called by the
OSGi framework. This does, however, _not_ work, if it is put in a separate
thread in the deactivate-method, as in
new Thread(new Runnable() {
@Override
public void run() {
shutdownBD();
shutdownDerby();
}
}).start();
In this case, the Runnable stops at the statement
fDS.getConnection().close();
No Throwable is thrown. Nevertheless, the DB does not seem to be stopped
correctly, as in the latter case (only) I find the two files dbex.lck and
db.lck in the DB folder.
Right before this "last" statement is called, I have around 12 threads
running, so the thread running the Runnable will most probably not be the last
thread in the JVM, if that matters.
For some reason I would like to shutdown things asynchroneously. What do I
miss here?
I am using Derby 10.8.2.2.
/Karl