db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Shuttlewood <andrew.shuttlew...@futureroute.co.uk>
Subject Database shutdown
Date Thu, 12 May 2005 14:29:17 GMT
We have a shutdown hook registered to close down our derby databases,
but every so often, even when the shutdown hook triggers, we find that
it spends a lot of time in LogToFile.recover

Our shutdown hook looks something like

        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
            public void run() {
                try {
                    Log.log(Level.INFO, "Attempting shutdown of Embedded
Core Driver.");
                    DriverManager.getConnection("jdbc:derby:" +
Foo.this.databaseName + ";shutdown=true");
                } catch (SQLException e) {
                    System.out.println("Shutdown: " +
Foo.this.databaseName);
                    Log.log(Level.INFO, "Embedded Core Driver Shut
Down", e);
                }
            }
        }));

This seems to do the right thing (sort of), but it doesn't always seem
to work. Am I missing something? Is a shutdown hook the absolutely wrong
place to do this? Am I perhaps making a obvious mistake?

I can't really see the problem which is very frustrating!

Also, in terms of memory usage, is it possible to reduce the amount of
memory used by all instances to some degree as we may wish to use a
number of instances at any one time. I was planning on potentially using
SoftReferences to manage a database pointer and then "shutting down" as
necessary, but I would quite like it if there was a way of setting a
global max number of pages or some such. Is this possible?


Mime
View raw message