本文整理汇总了Java中org.apache.tomcat.jdbc.pool.DataSourceProxy.close方法的典型用法代码示例。如果您正苦于以下问题:Java DataSourceProxy.close方法的具体用法?Java DataSourceProxy.close怎么用?Java DataSourceProxy.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tomcat.jdbc.pool.DataSourceProxy
的用法示例。
在下文中一共展示了DataSourceProxy.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAutoCommitFalse
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
@Test
public void testAutoCommitFalse() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setMinIdle(1);
d1.setMaxIdle(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultAutoCommit(Boolean.FALSE);
Connection c1 = d1.getConnection();
Assert.assertFalse("Auto commit should be false",c1.getAutoCommit());
c1.setAutoCommit(true);
Assert.assertTrue("Auto commit should be true",c1.getAutoCommit());
c1.close();
c1 = d1.getConnection();
Assert.assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
d1.close(true);
Assert.assertTrue("Connection should be closed",c1.isClosed());
}
示例2: testAutoCommitFalse
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
public void testAutoCommitFalse() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setMinIdle(1);
d1.setMaxIdle(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultAutoCommit(Boolean.FALSE);
Connection c1 = d1.getConnection();
assertFalse("Auto commit should be false",c1.getAutoCommit());
c1.setAutoCommit(true);
assertTrue("Auto commit should be true",c1.getAutoCommit());
c1.close();
c1 = d1.getConnection();
assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
d1.close(true);
assertTrue("Connection should be closed",c1.isClosed());
}
示例3: close
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
/**
* Closes all the data sources stored in the manager.
*/
@PreDestroy
public void close() {
final Iterator<DataSource> iter = dataSources.values().iterator();
while (iter.hasNext()) {
final DataSourceProxy dataSource = (DataSourceProxy) iter.next();
if (dataSource != null) {
dataSource.close();
}
iter.remove();
}
}