本文整理汇总了Java中org.apache.tomcat.jdbc.pool.DataSourceProxy类的典型用法代码示例。如果您正苦于以下问题:Java DataSourceProxy类的具体用法?Java DataSourceProxy怎么用?Java DataSourceProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSourceProxy类属于org.apache.tomcat.jdbc.pool包,在下文中一共展示了DataSourceProxy类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: getInfo
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入依赖的package包/类
@Override
public DataSourceInfo getInfo(Object resource) throws Exception {
DataSourceInfo dataSourceInfo = null;
if (canMap(resource)) {
PoolConfiguration conf = (PoolConfiguration) unwrap(resource);
DataSourceProxy proxy = (DataSourceProxy) conf;
dataSourceInfo = new DataSourceInfo();
dataSourceInfo.setBusyConnections(proxy.getNumActive());
dataSourceInfo.setEstablishedConnections(proxy.getNumIdle() + proxy.getNumActive());
dataSourceInfo.setMaxConnections(conf.getMaxActive());
dataSourceInfo.setJdbcUrl(conf.getUrl());
dataSourceInfo.setUsername(conf.getUsername());
dataSourceInfo.setResettable(false);
dataSourceInfo.setType("tomee-jdbc");
}
return dataSourceInfo;
}
开发者ID:psi-probe,项目名称:psi-probe,代码行数:19,代码来源:OpenEjbManagedDatasourceAccessor.java
示例4: 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
示例5: 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
示例6: testAsync0Idle0Size
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入依赖的package包/类
@Test
public void testAsync0Idle0Size() throws Exception {
System.out.println("[testPoolThreads20Connections10FairAsync] Starting fairness - Tomcat JDBC - Fair - Async");
this.datasource.getPoolProperties().setMaxActive(10);
this.datasource.getPoolProperties().setFairQueue(true);
this.datasource.getPoolProperties().setInitialSize(0);
try {
Future<Connection> cf = ((DataSourceProxy)datasource).getConnectionAsync();
cf.get(5, TimeUnit.SECONDS);
}finally {
tearDown();
}
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:Async0IdleTestBug50477.java
示例7: 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
示例8: 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();
}
}
开发者ID:Netflix,项目名称:metacat,代码行数:15,代码来源:DataSourceManager.java
示例9: dataSourceMBean
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入依赖的package包/类
@Bean
public Object dataSourceMBean(DataSource dataSource) {
if (dataSource instanceof DataSourceProxy) {
try {
return ((DataSourceProxy) dataSource).createPool().getJmxPool();
}
catch (SQLException ex) {
logger.warn("Cannot expose DataSource to JMX (could not connect)");
}
}
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:DataSourceAutoConfiguration.java
示例10: assertDataSourceHasInterceptors
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入依赖的package包/类
private void assertDataSourceHasInterceptors(DataSourceProxy ds)
throws ClassNotFoundException {
PoolProperties.InterceptorDefinition[] interceptors = ds
.getJdbcInterceptorsAsArray();
for (PoolProperties.InterceptorDefinition interceptor : interceptors) {
if (SlowQueryReport.class == interceptor.getInterceptorClass()) {
return;
}
}
fail("SlowQueryReport interceptor should have been set.");
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:TomcatDataSourceConfigurationTests.java
示例11: canMap
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入依赖的package包/类
@Override
public boolean canMap(Object resource) {
if (resource.getClass().getName()
.equals("org.apache.openejb.resource.jdbc.managed.local.ManagedDataSource")) {
Object wrapped = unwrap(resource);
return wrapped instanceof DataSourceProxy && wrapped instanceof PoolConfiguration;
}
return false;
}
开发者ID:psi-probe,项目名称:psi-probe,代码行数:11,代码来源:OpenEjbManagedDatasourceAccessor.java
示例12: testAsync0Idle0Size
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入依赖的package包/类
public void testAsync0Idle0Size() throws Exception {
System.out.println("[testPoolThreads20Connections10FairAsync] Starting fairness - Tomcat JDBC - Fair - Async");
init();
this.datasource.getPoolProperties().setMaxActive(10);
this.datasource.getPoolProperties().setFairQueue(true);
this.datasource.getPoolProperties().setInitialSize(0);
try {
Future<Connection> cf = ((DataSourceProxy)datasource).getConnectionAsync();
cf.get(5, TimeUnit.SECONDS);
}finally {
tearDown();
}
}
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:14,代码来源:Async0IdleTestBug50477.java
示例13: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论