Noel, Thomas;

Would there be any value in adding a CLOSE_DATABASE() system function that 
could be called to execute the cleanup routines by request. ( presumably 
during a user's shutdownhook )?

I added one to my test 1.4.182 build with a simple function that calls the 
following session method...

H2.engine.Session...

    public void closeDatabase(){
      // Add Small delay to return JDBC result to client...
      DatabaseCloser delayedCloser = new DatabaseCloser(getDatabase(), 
1000, true);
      delayedCloser.setName("H2 Close Delay - User Called Function");
      delayedCloser.setDaemon(true);
      delayedCloser.start();
    }

I call it when I am shutting down with the DB_CLOSE_ON_EXIT set to FALSE.  
It has not done anything good or bad that I can tell, but it makes me feel 
better about pulling the legs out from under the database.
Granted the only value would be for the embedded database as there is 
little you one can do in a shutdown hook to protect the remote clients.






On Monday, November 3, 2014 3:24:06 PM UTC-5, Kenton Garner wrote:
>
>
> I was looking through the 1.4.182 code and I noticed that the 
> H2.engine.Database.close(...) method will never process some shutdown code 
> if this flag is set to FALSE.
>
> I have it set to FALSE in my case because I have my own shutdown hook that 
> stops execution threads in my application and some of those threads may 
> need to do some final updates to the database on the way down.
> In my case I know the database is running embedded and so I am not 
> concerned about additional JDBC connections during my shutdownhook.  
>
> However, based on the code, should I be concerned that clean up code in 
> the close() method will never be run?
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to