本文整理汇总了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);
}
}