Index: jbidwatcher/trunk/src/com/jbidwatcher/util/db/ActiveRecord.java
===================================================================
--- jbidwatcher/trunk/src/com/jbidwatcher/util/db/ActiveRecord.java (revision 512)
+++ jbidwatcher/trunk/src/com/jbidwatcher/util/db/ActiveRecord.java (revision 574)
@@ -16,18 +16,26 @@
* Time: 1:54:46 PM
*/
public abstract class ActiveRecord extends HashBacked {
+ private static ArrayList
sTables = new ArrayList();
protected static Table openDB(String tableName) {
if (tableName == null) return null;
Table db;
try {
db = new Table(tableName);
+ sTables.add(db);
} catch (Exception e) {
throw new RuntimeException("Can't access the " + tableName + " database table", e);
}
return db;
}
+ public static void shutdown() {
+ for(Table t : sTables) {
+ t.shutdown();
+ }
+ }
+
protected static Table getTable(Object o) {
ActiveRecord record = (ActiveRecord) o;
return record.getDatabase();