本文整理汇总了Java中com.mchange.v2.c3p0.C3P0Registry类的典型用法代码示例。如果您正苦于以下问题:Java C3P0Registry类的具体用法?Java C3P0Registry怎么用?Java C3P0Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
C3P0Registry类属于com.mchange.v2.c3p0包,在下文中一共展示了C3P0Registry类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closePolledDataSources
import com.mchange.v2.c3p0.C3P0Registry; //导入依赖的package包/类
/**
* Close all pooled datasources created by C3P0.
*/
public static void closePolledDataSources() {
for (PooledDataSource dataSource:(Set<PooledDataSource>)C3P0Registry.allPooledDataSources()) {
try {
dataSource.close();
DataSources.destroy(dataSource);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
示例2: collectDBPoolMetrics
import com.mchange.v2.c3p0.C3P0Registry; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void collectDBPoolMetrics(MonitorElement clientElem) {
Set dsList = C3P0Registry.getPooledDataSources();
if (dsList == null || dsList.size() == 0) {
return;
}
/**
* Step 2: 匹配对应的jdbc url
*/
for (Object ds : dsList) {
if (!ComboPooledDataSource.class.isAssignableFrom(ds.getClass())) {
continue;
}
ComboPooledDataSource pds = (ComboPooledDataSource) ds;
String jdbcURL = pds.getJdbcUrl();
/**
* 匹配客户端应用
*/
MonitorElementInstance inst = this.matchElemInstance(clientElem, jdbcURL);
if (inst == null) {
continue;
}
collectDataSourceStat(inst, pds);
}
}
示例3: selectDataSource
import com.mchange.v2.c3p0.C3P0Registry; //导入依赖的package包/类
@Override
public synchronized DataSource selectDataSource(String tenantIdentifier) {
PooledDataSource pooledDataSource = C3P0Registry.pooledDataSourceByName(tenantIdentifier);
if (pooledDataSource == null) {
pooledDataSource = proccessDataSource(tenantIdentifier);
}
return pooledDataSource;
}
示例4: selectDataSource
import com.mchange.v2.c3p0.C3P0Registry; //导入依赖的package包/类
@Override
public synchronized DataSource selectDataSource(String tenantIdentifier) {
PooledDataSource pooledDataSource = C3P0Registry.pooledDataSourceByName(tenantIdentifier);
if (pooledDataSource == null) {
pooledDataSource = proccessDataSource(tenantIdentifier);
}
System.out.println("select-data-source-base-multi-tenant");
return pooledDataSource;
}
开发者ID:mojtaba-sharif,项目名称:repository-multi-tenancy,代码行数:10,代码来源:BaseMultiTenantConnectionProviderImp.java
示例5: getCatalogDS
import com.mchange.v2.c3p0.C3P0Registry; //导入依赖的package包/类
public static DataSource getCatalogDS() {
@SuppressWarnings("unchecked")
Set<DataSource> c3p0pools = C3P0Registry.allPooledDataSources();
return c3p0pools.iterator().next();
}