From 07666e16a65fd655dbac36b18aa8dcbfa1e860ce Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 26 Jul 2007 19:13:34 +0000 Subject: [PATCH] Added PersistenceContext.shutdown(), exposed shutdown() in ConnectionProvider. --- .../jdbc/depot/PersistenceContext.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/java/com/samskivert/jdbc/depot/PersistenceContext.java b/src/java/com/samskivert/jdbc/depot/PersistenceContext.java index 5df0aab..8aa2931 100644 --- a/src/java/com/samskivert/jdbc/depot/PersistenceContext.java +++ b/src/java/com/samskivert/jdbc/depot/PersistenceContext.java @@ -141,6 +141,22 @@ public class PersistenceContext _cache = adapter; } + /** + * Shuts this persistence context down, shutting down any caching system in use and shutting + * down the JDBC connection pool. + */ + public void shutdown () + { + try { + if (_cache != null) { + _cache.shutdown(); + } + } catch (Throwable t) { + log.log(Level.WARNING, "Failure shutting down Depot cache.", t); + } + _conprov.shutdown(); + } + /** * Create and return a new {@link SQLBuilder} for the appropriate dialect. * @@ -183,7 +199,8 @@ public class PersistenceContext * and register a pre-migration for every single schema migration and they will then be * guaranteed to be run in registration order and with predictable pre- and post-conditions. */ - public void registerMigration (Class type, EntityMigration migration) + public void registerMigration ( + Class type, EntityMigration migration) { getRawMarshaller(type).registerMigration(migration); }