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


Java PoolProperties.getUsername方法代码示例

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


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

示例1: ping

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
/**
 * 데이터베이스 접속 여부 확인
 *
 * @param conSupplier
 *            커넥션정보를 제공
 * @param onSuccess
 *            접속성공시 처리
 * @param exHandler
 *            에러발생시 처리
 * @param timeoutSec
 *            핑테스트 대기시간 (Secound)
 * @return 접속 성공여부
 */
public static void ping(Supplier<PoolProperties> conSupplier, Consumer<Boolean> onSuccess, Consumer<Throwable> exHandler,
		int timeoutSec, boolean async) {

	// boolean result = false;
	PoolProperties prop = conSupplier.get();

	String driverClassName = prop.getDriverClassName();
	String url = prop.getUrl();
	String userName = prop.getUsername();
	String password = prop.getPassword();

	if (async) {
		ExecutorDemons.getGargoyleSystemExecutorSerivce().execute(() -> {
			ping(onSuccess, exHandler, timeoutSec, driverClassName, url, userName, password);
		});
	} else {
		ping(onSuccess, exHandler, timeoutSec, driverClassName, url, userName, password);
	}

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:34,代码来源:DbUtil.java

示例2: setPoolProperties

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
public void setPoolProperties(PoolProperties poolProperties) {
    if (poolProperties == null)
        return;

    String url = poolProperties.getUrl();
    if (url == null || url.length() == 0)
        return;

    String userName = poolProperties.getUsername();
    if (userName == null || userName.length() == 0)
        return;

    url = getShortString(url, SEMICOLON);
    userName = getShortString(userName, AT);
    ConcurrentHashMap<String, PoolProperties> map = poolPropertiesMap.get(url);

    if (map == null) {
        synchronized (LOCK) {
            map = poolPropertiesMap.get(url);
            if (map == null) {
                map = new ConcurrentHashMap<>();
                poolPropertiesMap.put(url, map);
            }
        }
    }

    /*
     * if (!map.containsKey(userName)) { synchronized (LOCK2) { if (!map.containsKey(userName)) { map.put(userName,
     * poolProperties); } } }
     */

    // avoid caching for InitSQL
    synchronized (LOCK2) {
        map.put(userName, poolProperties);
    }
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:37,代码来源:PoolPropertiesHolder.java


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