本文整理汇总了Java中org.ldaptive.pool.PoolConfig类的典型用法代码示例。如果您正苦于以下问题:Java PoolConfig类的具体用法?Java PoolConfig怎么用?Java PoolConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PoolConfig类属于org.ldaptive.pool包,在下文中一共展示了PoolConfig类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newPoolConfig
import org.ldaptive.pool.PoolConfig; //导入依赖的package包/类
/**
* Creates a new instance of pool config.
*
* @param config to copy properties from
* @return pool config
*/
private static PoolConfig newPoolConfig(final PoolConfig config) {
final PoolConfig pc = new PoolConfig();
pc.setMinPoolSize(config.getMinPoolSize());
pc.setMaxPoolSize(config.getMaxPoolSize());
pc.setValidateOnCheckIn(config.isValidateOnCheckIn());
pc.setValidateOnCheckOut(config.isValidateOnCheckOut());
pc.setValidatePeriodically(config.isValidatePeriodically());
pc.setValidatePeriod(config.getValidatePeriod());
return pc;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:PoolingLdaptiveResourceCRLFetcher.java
示例2: newPoolConfig
import org.ldaptive.pool.PoolConfig; //导入依赖的package包/类
/**
* Creates a new instance of pool config.
*
* @param config to copy properties from
* @return pool config
*/
private PoolConfig newPoolConfig(final PoolConfig config) {
final PoolConfig pc = new PoolConfig();
pc.setMinPoolSize(config.getMinPoolSize());
pc.setMaxPoolSize(config.getMaxPoolSize());
pc.setValidateOnCheckIn(config.isValidateOnCheckIn());
pc.setValidateOnCheckOut(config.isValidateOnCheckOut());
pc.setValidatePeriodically(config.isValidatePeriodically());
pc.setValidatePeriod(config.getValidatePeriod());
return pc;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:PoolingLdaptiveResourceCRLFetcher.java
示例3: newLdaptivePoolConfig
import org.ldaptive.pool.PoolConfig; //导入依赖的package包/类
/**
* New pool config pool config.
*
* @param l the ldap properties
* @return the pool config
*/
public static PoolConfig newLdaptivePoolConfig(final AbstractLdapProperties l) {
LOGGER.debug("Creating LDAP connection pool configuration for [{}]", l.getLdapUrl());
final PoolConfig pc = new PoolConfig();
pc.setMinPoolSize(l.getMinPoolSize());
pc.setMaxPoolSize(l.getMaxPoolSize());
pc.setValidateOnCheckOut(l.isValidateOnCheckout());
pc.setValidatePeriodically(l.isValidatePeriodically());
pc.setValidatePeriod(newDuration(l.getValidatePeriod()));
pc.setValidateTimeout(newDuration(l.getValidateTimeout()));
return pc;
}
示例4: poolConfig
import org.ldaptive.pool.PoolConfig; //导入依赖的package包/类
private PoolConfig poolConfig() {
PoolConfig pc = new PoolConfig();
pc.setMaxPoolSize(properties.getMaxPoolSize());
pc.setMinPoolSize(properties.getMinPoolSize());
pc.setValidateOnCheckIn(properties.isValidateOnCheckIn());
pc.setValidateOnCheckOut(properties.isValidateOnCheckOut());
int a = 0;
// TODO new in 1.2
//pc.setValidatePeriod(properties.getValidatePeriod());
pc.setValidatePeriodically(properties.isValidatePeriodically());
return pc;
}
示例5: newLdaptiveBlockingConnectionPool
import org.ldaptive.pool.PoolConfig; //导入依赖的package包/类
/**
* New blocking connection pool connection pool.
*
* @param l the l
* @return the connection pool
*/
public static ConnectionPool newLdaptiveBlockingConnectionPool(final AbstractLdapProperties l) {
final DefaultConnectionFactory bindCf = newLdaptiveConnectionFactory(l);
final PoolConfig pc = newLdaptivePoolConfig(l);
final BlockingConnectionPool cp = new BlockingConnectionPool(pc, bindCf);
cp.setBlockWaitTime(newDuration(l.getBlockWaitTime()));
cp.setPoolConfig(pc);
final IdlePruneStrategy strategy = new IdlePruneStrategy();
strategy.setIdleTime(newDuration(l.getIdleTime()));
strategy.setPrunePeriod(newDuration(l.getPrunePeriod()));
cp.setPruneStrategy(strategy);
switch (l.getValidator().getType().trim().toLowerCase()) {
case "compare":
final CompareRequest compareRequest = new CompareRequest();
compareRequest.setDn(l.getValidator().getDn());
compareRequest.setAttribute(new LdapAttribute(l.getValidator().getAttributeName(),
l.getValidator().getAttributeValues().toArray(new String[]{})));
compareRequest.setReferralHandler(new SearchReferralHandler());
cp.setValidator(new CompareValidator(compareRequest));
break;
case "none":
LOGGER.debug("No validator is configured for the LDAP connection pool of [{}]", l.getLdapUrl());
break;
case "search":
default:
final SearchRequest searchRequest = new SearchRequest();
searchRequest.setBaseDn(l.getValidator().getBaseDn());
searchRequest.setSearchFilter(new SearchFilter(l.getValidator().getSearchFilter()));
searchRequest.setReturnAttributes(ReturnAttributes.NONE.value());
searchRequest.setSearchScope(l.getValidator().getScope());
searchRequest.setSizeLimit(1L);
searchRequest.setReferralHandler(new SearchReferralHandler());
cp.setValidator(new SearchValidator(searchRequest));
break;
}
cp.setFailFastInitialize(l.isFailFast());
if (StringUtils.isNotBlank(l.getPoolPassivator())) {
final AbstractLdapProperties.LdapConnectionPoolPassivator pass =
AbstractLdapProperties.LdapConnectionPoolPassivator.valueOf(l.getPoolPassivator().toUpperCase());
switch (pass) {
case CLOSE:
cp.setPassivator(new ClosePassivator());
LOGGER.debug("Created [{}] passivator for [{}]", l.getPoolPassivator(), l.getLdapUrl());
break;
case BIND:
if (StringUtils.isNotBlank(l.getBindDn()) && StringUtils.isNoneBlank(l.getBindCredential())) {
final BindRequest bindRequest = new BindRequest();
bindRequest.setDn(l.getBindDn());
bindRequest.setCredential(new Credential(l.getBindCredential()));
cp.setPassivator(new BindPassivator(bindRequest));
LOGGER.debug("Created [{}] passivator for [{}]", l.getPoolPassivator(), l.getLdapUrl());
} else {
LOGGER.warn("No [{}] passivator could be created for [{}] given bind credentials are not specified",
l.getPoolPassivator(), l.getLdapUrl());
}
break;
default:
break;
}
}
LOGGER.debug("Initializing ldap connection pool for [{}] and bindDn [{}]", l.getLdapUrl(), l.getBindDn());
cp.initialize();
return cp;
}