當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。