本文整理汇总了Java中org.logicalcobwebs.proxool.ProxoolFacade类的典型用法代码示例。如果您正苦于以下问题:Java ProxoolFacade类的具体用法?Java ProxoolFacade怎么用?Java ProxoolFacade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProxoolFacade类属于org.logicalcobwebs.proxool包,在下文中一共展示了ProxoolFacade类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
/**
* Release all resources held by this provider. JavaDoc requires a second sentence.
* @throws HibernateException
*/
public void close() throws HibernateException {
// If the provider was leeching off an existing pool don't close it
if (existingPool) {
return;
}
// We have created the pool ourselves, so shut it down
try {
ProxoolFacade.shutdown(0);
}
catch (Exception e) {
// If you're closing down the ConnectionProvider chances are an
// is not a real big deal, just warn
log.warn("Exception occured when closing the Proxool pool", e);
throw new HibernateException("Exception occured when closing the Proxool pool", e);
}
}
示例2: registerPool
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
/**
* 注册一个可用的proxool数据库连接池
*
* @param url
* -- proxool 的jdbc url
* @param props
* -- 连接池配置属性
* @return -- 数据库连接池别名或者拼接的URL字符串
* @exception -- 运行时应用异常(RuntimeAppException)
*/
public static synchronized String registerPool(String url, Properties props) {
String alias = null;
logger.info("数据库连接URL:{}, 配置属性:{}", url, props);
try {
alias = ProxoolFacade.registerConnectionPool(url, props);
} catch (Exception ex) {
// ErrorTrackService ets = FwErrorTrackService.getInstance();
// RuntimeAppException raex = ets.newRuntimeError("fw06002", ex);
// raex.formatErrorMsg(alias, url, props);
// ets.trackAndThrow(raex);
String msg = "注册proxool数据库连接池异常. alias:%s, url:%s, props:%s";
msg = String.format(msg, alias, url, props);
throw new FwRuntimeException(msg, ex);
}
return alias;
}
示例3: getIdleConnectionCount
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
public Integer getIdleConnectionCount() {
try {
SnapshotIF snapshot = ProxoolFacade.getSnapshot(getConfiguration().getName());
return snapshot.getAvailableConnectionCount();
} catch (ProxoolException e) {
logger.error("", e);
return null;
}
}
示例4: getBusyConnectionCount
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
public Integer getBusyConnectionCount() {
try {
SnapshotIF snapshot = ProxoolFacade.getSnapshot(getConfiguration().getName());
return snapshot.getActiveConnectionCount();
} catch (ProxoolException e) {
logger.error("", e);
return null;
}
}
示例5: getConnectionCount
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
public Integer getConnectionCount() {
try {
SnapshotIF snapshot = ProxoolFacade.getSnapshot(getConfiguration().getName());
return (int)snapshot.getConnectionCount();
} catch (ProxoolException e) {
logger.error("", e);
return null;
}
}
示例6: init
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
static void init() {
try {
String proxoolClazz = "org.logicalcobwebs.proxool.ProxoolDriver";
Class.forName(proxoolClazz);
logger.info("proxoolClazz:org.logicalcobwebs.proxool.ProxoolDriver");
// defaultProps.setProperty("proxool.simultaneous-build-throttle",
// "10");
// defaultProps.setProperty("proxool.test-before-use", "true");
// defaultProps.setProperty("proxool.house-keeping-test-sql",
// "select 0");
// defaultProps.setProperty("proxool.house-keeping-sleep-time",
// "60000");
// defaultProps.setProperty("proxool.maximum-active-time",
// "300000");
// defaultProps.setProperty("proxool.maximum-connection-count",
// "50");
// defaultProps.setProperty("proxool.minimum-connection-count",
// "1");
// defaultProps.setProperty("proxool.maximum-connection-lifetime",
// "1800000");
// defaultProps.setProperty("proxool.recently-started-threshold",
// "60000");
// defaultProps.setProperty("proxool.overload-without-refusal-lifetime",
// "60000");
// defaultProps.setProperty("proxool.prototype-count", "0");
// logger.info("proxool数据库连接池默认配置:{}", defaultProps);
ProxoolFacade.addProxoolListener(proxoolListener); // add proxool
// listener
} catch (Exception ex) {
throw new FwRuntimeException("初始化数据库连接提供者失败", ex);
// FwErrorTrackService.getInstance().trackAndThrowRuntime("fw06001",
// ex);
}
}
示例7: removePool
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
/**
* 关闭指定别名的数据库连接池
*
* @param alias
* -- 数据库连接池
* @exception -- 运行时应用异常(RuntimeAppException)
*/
public static synchronized void removePool(String alias) {
try {
logger.info("关闭指定别名的数据库连接池[alias:{}]", alias);
ProxoolFacade.removeConnectionPool(alias);
} catch (Exception ex) {
logger.error("关闭数据库连接池异常, 别名:" + alias, ex);
}
}
示例8: toString
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
@Override
public String toString() {
try {
ConnectionPoolDefinitionIF poolDef = ProxoolFacade.getConnectionPoolDefinition("openfire");
SnapshotIF poolStats = ProxoolFacade.getSnapshot("openfire", true);
return poolDef.getMinimumConnectionCount()+","+poolDef.getMaximumConnectionCount()+","
+poolStats.getAvailableConnectionCount()+","+poolStats.getActiveConnectionCount();
}
catch (ProxoolException e) {
return "Default Connection Provider";
}
}
示例9: destroy
import org.logicalcobwebs.proxool.ProxoolFacade; //导入依赖的package包/类
public void destroy() {
ProxoolFacade.shutdown();
}