close DriverDataSource when we're done with it

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1022190 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-10-13 17:04:57 +00:00
parent 0f0f01d366
commit 5a7b1765c7
2 changed files with 16 additions and 0 deletions

View File

@ -504,6 +504,7 @@ public class MappingTool
tool.setSchemaGroup(getSchemaGroup());
tool.run();
tool.record();
tool.clear();
}
}

View File

@ -44,6 +44,8 @@ import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.jdbc.sql.SQLExceptions;
import org.apache.openjpa.lib.conf.Configurations;
import org.apache.openjpa.lib.identifier.IdentifierUtil;
import org.apache.openjpa.lib.jdbc.DecoratingDataSource;
import org.apache.openjpa.lib.jdbc.DelegatingDataSource;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.lib.meta.MetaDataSerializer;
import org.apache.openjpa.lib.util.Files;
@ -137,6 +139,19 @@ public class SchemaTool {
_dict = _conf.getDBDictionaryInstance();
}
/**
* Cleanup DataSource after run()/record()
*/
public void clear() {
if (_ds != null && _ds instanceof DelegatingDataSource) {
try {
((DelegatingDataSource)_ds).close();
} catch (Exception e) {
// no-op
}
}
}
/**
* The action supplied on construction.
*/