mirror of
https://github.com/apache/openjpa.git
synced 2025-02-21 01:15:30 +00:00
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:
parent
0f0f01d366
commit
5a7b1765c7
@ -504,6 +504,7 @@ public class MappingTool
|
||||
tool.setSchemaGroup(getSchemaGroup());
|
||||
tool.run();
|
||||
tool.record();
|
||||
tool.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user