当前位置: 首页>>代码示例>>Java>>正文


Java DataSourceProxy.setMaxActive方法代码示例

本文整理汇总了Java中org.apache.tomcat.jdbc.pool.DataSourceProxy.setMaxActive方法的典型用法代码示例。如果您正苦于以下问题:Java DataSourceProxy.setMaxActive方法的具体用法?Java DataSourceProxy.setMaxActive怎么用?Java DataSourceProxy.setMaxActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tomcat.jdbc.pool.DataSourceProxy的用法示例。


在下文中一共展示了DataSourceProxy.setMaxActive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDefaultCatalog

import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
@Test
public void testDefaultCatalog() throws Exception {
    DataSourceProxy d1 = this.createDefaultDataSource();
    d1.setMaxActive(1);
    d1.setJdbcInterceptors(ConnectionState.class.getName());
    d1.setDefaultCatalog("information_schema");
    d1.setMinIdle(1);
    Connection c1 = d1.getConnection();
    Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
    c1.close();
    c1 = d1.getConnection();
    Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
    c1.setCatalog("mysql");
    Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"mysql");
    c1.close();
    c1 = d1.getConnection();
    Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:TestConnectionState.java

示例2: 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());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:TestConnectionState.java

示例3: 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());
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:18,代码来源:TestConnectionState.java

示例4: testDefaultCatalog

import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
public void testDefaultCatalog() throws Exception {
    DataSourceProxy d1 = this.createDefaultDataSource();
    d1.setMaxActive(1);
    d1.setJdbcInterceptors(ConnectionState.class.getName());
    d1.setDefaultCatalog("information_schema");
    d1.setMinIdle(1);
    Connection c1 = d1.getConnection();
    assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
    c1.close();
    c1 = d1.getConnection();
    assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
    c1.setCatalog("mysql");
    assertEquals("Catalog should be information_schema",c1.getCatalog(),"mysql");
    c1.close();
    c1 = d1.getConnection();
    assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:18,代码来源:TestConnectionState.java

示例5: testAutoCommitTrue

import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
@Test
public void testAutoCommitTrue() throws Exception {
    DataSourceProxy d1 = this.createDefaultDataSource();
    d1.setMaxActive(1);
    d1.setJdbcInterceptors(ConnectionState.class.getName());
    d1.setDefaultAutoCommit(Boolean.TRUE);
    d1.setMinIdle(1);
    Connection c1 = d1.getConnection();
    Assert.assertTrue("Auto commit should be true",c1.getAutoCommit());
    c1.setAutoCommit(false);
    Assert.assertFalse("Auto commit should be false",c1.getAutoCommit());
    c1.close();
    c1 = d1.getConnection();
    Assert.assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:16,代码来源:TestConnectionState.java

示例6: testAutoCommitTrue

import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
public void testAutoCommitTrue() throws Exception {
    DataSourceProxy d1 = this.createDefaultDataSource();
    d1.setMaxActive(1);
    d1.setJdbcInterceptors(ConnectionState.class.getName());
    d1.setDefaultAutoCommit(Boolean.TRUE);
    d1.setMinIdle(1);
    Connection c1 = d1.getConnection();
    assertTrue("Auto commit should be true",c1.getAutoCommit());
    c1.setAutoCommit(false);
    assertFalse("Auto commit should be false",c1.getAutoCommit());
    c1.close();
    c1 = d1.getConnection();
    assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:15,代码来源:TestConnectionState.java


注:本文中的org.apache.tomcat.jdbc.pool.DataSourceProxy.setMaxActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。