本文整理匯總了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);
}
}
示例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);
}
}