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


Java Config类代码示例

本文整理汇总了Java中org.apache.commons.pool.impl.GenericObjectPool.Config的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Config类属于org.apache.commons.pool.impl.GenericObjectPool包,在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: useBundleClasses

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
@Override
protected void useBundleClasses() throws Exception
{
    new LdapNetworkConnection().close();
    new SaslGssApiRequest();
    new Krb5LoginConfiguration();
    new AddFuture( new LdapNetworkConnection(), 2 );
    new LdapConnectionTemplate( new LdapConnectionPool( new DefaultPoolableLdapConnectionFactory(
        new LdapConnectionConfig() ) ) );
    FilterBuilder.and( FilterBuilder.not( FilterBuilder.contains( "cn", "a", "b" ) ) ).toString();

    // Test for DIRAPI-239
    PoolableObjectFactory<LdapConnection> factory = new DefaultPoolableLdapConnectionFactory(
        new LdapConnectionConfig() );
    Config config = new Config();
    LdapConnectionPool ldapConnectionPool = new LdapConnectionPool( factory, config );
    ldapConnectionPool.getLdapApiService();
    ldapConnectionPool.getTestOnBorrow();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:20,代码来源:ApiLdapClientApiOsgiTest.java

示例2: parseShardingConfig

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
/**
 * 
 * 功能描述:解析配置文件
 * 
 * @param shardConfig 参数说明 返回值: 类型 <说明>
 */
@SuppressWarnings("unchecked")
private void parseShardingConfig(ShardConfig shardConfig) {
    lstInfo4Jedis = new ArrayList<ShardInfo4Jedis>();
    Config config = new Config();
    setPoolParameters(poolConfig, config);
    shardConfig.setConfig(config);
    for (ShardInfo4Jedis shardInfo : shardConfig.getShards()) {
        lstInfo4Jedis.add(shardInfo);
        for (NodeInfo4Jedis node : shardInfo.getNodes()) {
            node.setConfig(shardConfig.getConfig());
        }
    }

    isSharding = lstInfo4Jedis.size() > 1 ? true : false;
}
 
开发者ID:m18507308080,项目名称:onolisa,代码行数:22,代码来源:ConfigManager4Spring.java

示例3: JdbcCompiledQuery

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
public JdbcCompiledQuery(JdbcDataContext dc, Query query) {
    super(query);
    _query = query;
    _sql = dc.getQueryRewriter().rewriteQuery(query);

    final Config config = new Config();
    config.maxActive = getSystemPropertyValue(JdbcDataContext.SYSTEM_PROPERTY_COMPILED_QUERY_POOL_MAX_SIZE, -1);
    config.minEvictableIdleTimeMillis = getSystemPropertyValue(
            JdbcDataContext.SYSTEM_PROPERTY_COMPILED_QUERY_POOL_MIN_EVICTABLE_IDLE_TIME_MILLIS, 500);
    config.timeBetweenEvictionRunsMillis = getSystemPropertyValue(
            JdbcDataContext.SYSTEM_PROPERTY_COMPILED_QUERY_POOL_TIME_BETWEEN_EVICTION_RUNS_MILLIS, 1000);

    _pool = new GenericObjectPool<JdbcCompiledQueryLease>(new JdbcCompiledQueryLeaseFactory(dc, _sql), config);
    _closed = false;

    logger.debug("Created compiled JDBC query: {}", _sql);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:18,代码来源:JdbcCompiledQuery.java

示例4: setPoolParameters

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
/**
 * 处理连接池信息
 * 
 * @param poolConfig 参数说明
 * @param config 参数说明
 */
private void setPoolParameters(PoolConfig poolConfig, Config config) {

    if (!StringUtils.isBlank(poolConfig.getTestOnBorrow())) {
        // 获取连接池是否检测可用性
        config.testOnBorrow = Boolean.valueOf(poolConfig.getTestOnBorrow());
    }

    if (!StringUtils.isBlank(poolConfig.getTestOnReturn())) {
        // 归还时是否检测可用性
        config.testOnReturn = Boolean.valueOf(poolConfig.getTestOnReturn());
    }
    if (!StringUtils.isBlank(poolConfig.getTestWhileIdle())) {
        // 空闲时是否检测可用性
        config.testWhileIdle = Boolean.valueOf(poolConfig.getTestWhileIdle());
    } else {
        config.testWhileIdle = true;
    }
    if (!StringUtils.isBlank(poolConfig.getWhenExhaustedAction())) {
        config.whenExhaustedAction = Byte.valueOf(poolConfig.getWhenExhaustedAction());
    }
    if (!StringUtils.isBlank(poolConfig.getTimeBetweenEvictionRunsMillis())) {
        config.timeBetweenEvictionRunsMillis = Long.valueOf(poolConfig.getTimeBetweenEvictionRunsMillis());
    } else {
        config.timeBetweenEvictionRunsMillis = 30000L;
    }
    if (!StringUtils.isBlank(poolConfig.getNumTestsPerEvictionRun())) {
        config.numTestsPerEvictionRun = Integer.valueOf(poolConfig.getNumTestsPerEvictionRun());
    } else {
        config.numTestsPerEvictionRun = -1;
    }
    if (!StringUtils.isBlank(poolConfig.getMinEvictableIdleTimeMillis())) {
        config.minEvictableIdleTimeMillis = Integer.valueOf(poolConfig.getMinEvictableIdleTimeMillis());
    } else {
        config.minEvictableIdleTimeMillis = 60000L;
    }
    if (!StringUtils.isBlank(poolConfig.getSoftMinEvictableIdleTimeMillis())) {
        config.softMinEvictableIdleTimeMillis = Integer.valueOf(poolConfig.getSoftMinEvictableIdleTimeMillis());
    }
}
 
开发者ID:m18507308080,项目名称:onolisa,代码行数:46,代码来源:ConfigManager4Spring.java

示例5: NormalizerPool

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
private NormalizerPool(Set<CHECKType> exclusions, boolean errorAsWarning)
{
   Config poolcfg = new Config();
   poolcfg.maxIdle = 3;
   poolcfg.maxActive = 20;
   poolcfg.timeBetweenEvictionRunsMillis = 1000 * 3600;
   poolcfg.testWhileIdle = true;
   // since we do not set maxActive for the moment this does not matter
   poolcfg.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
   poolcfg.maxWait = 40000;
   NormalizerFactory fact = new NormalizerFactory(exclusions, errorAsWarning);

   pool = new GenericObjectPool(fact, poolcfg);
}
 
开发者ID:chemalot,项目名称:chemalot,代码行数:15,代码来源:NormalizerPool.java

示例6: JedisPool

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
public JedisPool(final String host) {
URI uri = URI.create(host);
if (uri.getScheme() != null && uri.getScheme().equals("redis")) {
    String h = uri.getHost();
    int port = uri.getPort();
    String password = uri.getUserInfo().split(":", 2)[1];
    int database = Integer.parseInt(uri.getPath().split("/", 2)[1]);
    this.internalPool = new GenericObjectPool(new JedisFactory(h, port,
	    Protocol.DEFAULT_TIMEOUT, password, database), new Config());
} else {
    this.internalPool = new GenericObjectPool(new JedisFactory(host,
	    Protocol.DEFAULT_PORT, Protocol.DEFAULT_TIMEOUT, null,
	    Protocol.DEFAULT_DATABASE), new Config());
}
   }
 
开发者ID:wjw465150,项目名称:shiro-redis,代码行数:16,代码来源:JedisPool.java

示例7: HBaseConnectionManager

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
public HBaseConnectionManager() {
	connectionFactory = new HBaseConnectionFactory();
	poolConfiguration = new Config();
	poolConfiguration.testOnBorrow = true;
	poolConfiguration.testWhileIdle = true;
	poolConfiguration.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
	poolConfiguration.maxActive = 4;
	poolConfiguration.maxIdle = 2;
	poolConfiguration.minIdle = 1;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:HBaseConnectionManager.java

示例8: getThreadPoolConfig

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
@Override
public Config getThreadPoolConfig() {
    Config config = new Config();
    config.maxActive = -1; // No upper limit on the number of threads.
    config.minIdle   = 5;  // Always have 5 threads waiting to go.
    config.maxIdle   = 10; // Maximum number of idle threads.
    config.testOnBorrow = false; // Don't test on borrow to improve performance........
    config.testOnReturn = true; // But test on return instead
    config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
    return config;
}
 
开发者ID:workplacesystems,项目名称:queuj,代码行数:12,代码来源:ProcessRunnerImpl.java

示例9: CrawlDB

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
/**
 * @param host
 * @param port
 * @param password
 * @param timeout
 * @param toCrawlDB
 *            待抓取的数据库编号
 * @param crawledDB
 *            已经抓取的URL的数据库的编号
 */
public CrawlDB(String host, int port, String password, int timeout,
		int toCrawlDB, int crawledDB) {
	tocrawl = new JedisPool(new Config(), host, port, timeout, password,
			toCrawlDB);
	crawled = new JedisPool(new Config(), host, port, timeout, password,
			crawledDB);
	this.toCrawlDB = toCrawlDB;
	this.crawledDB = crawledDB;
	LOG.info("CrawlDB init");
}
 
开发者ID:gsh199449,项目名称:DistributedCrawler,代码行数:21,代码来源:CrawlDB.java

示例10: testMov

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
@Test
public void testMov(){
	JedisPool pool0 = new JedisPool(new Config(),"localhost",6377,1000,"940409",0);
	JedisPool pool1= new JedisPool(new Config(),"localhost",6377,1000,"940409",1);
	Jedis j0 = pool0.getResource();
	Jedis j1 = pool1.getResource();
	System.out.println(j1.get("1"));
	j0.set("1", "haha");
	j0.move("1", 1);
	System.out.println(j1.get("1"));
	
	
}
 
开发者ID:gsh199449,项目名称:DistributedCrawler,代码行数:14,代码来源:TestJedis.java

示例11: setTestParameters

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
/**
 * 功能描述:验证连接可用性的参数设置
 * 
 * @param config 参数说明 返回值: 类型 <说明>
 * @param whenExhaustedAction 参数说明 返回值: 类型 <说明>
 * @param testOnBorrow 参数说明 返回值: 类型 <说明>
 * @param testOnReturn 参数说明 返回值: 类型 <说明>
 * @param testWhileIdle 参数说明 返回值: 类型 <说明>
 * @param timeBetweenEvictionRunsMillis 参数说明 返回值: 类型 <说明>
 * @param numTestsPerEvictionRun 参数说明 返回值: 类型 <说明>
 * @param minEvictableIdleTimeMillis 参数说明 返回值: 类型 <说明>
 * @param softMinEvictableIdleTimeMillis 参数说明 返回值: 类型 <说明>
 */
private void setTestParameters(Config config, String whenExhaustedAction, String testOnBorrow, String testOnReturn,
        String testWhileIdle, String timeBetweenEvictionRunsMillis, String numTestsPerEvictionRun,
        String minEvictableIdleTimeMillis, String softMinEvictableIdleTimeMillis) {

    if (!StringUtils.isBlank(testOnBorrow)) {
        // 获取连接池是否检测可用性
        config.testOnBorrow = Boolean.valueOf(testOnBorrow);
    }

    if (!StringUtils.isBlank(testOnReturn)) {
        // 归还时是否检测可用性
        config.testOnReturn = Boolean.valueOf(testOnReturn);
    }
    if (!StringUtils.isBlank(testWhileIdle)) {
        // 空闲时是否检测可用性
        config.testWhileIdle = Boolean.valueOf(testWhileIdle);
    } else {
        config.testWhileIdle = true;
    }
    if (!StringUtils.isBlank(whenExhaustedAction)) {
        config.whenExhaustedAction = Byte.valueOf(whenExhaustedAction);
    }
    if (!StringUtils.isBlank(timeBetweenEvictionRunsMillis)) {
        config.timeBetweenEvictionRunsMillis = Long.valueOf(timeBetweenEvictionRunsMillis);
    } else {
        config.timeBetweenEvictionRunsMillis = 30000L;
    }
    if (!StringUtils.isBlank(numTestsPerEvictionRun)) {
        config.numTestsPerEvictionRun = Integer.valueOf(numTestsPerEvictionRun);
    } else {
        config.numTestsPerEvictionRun = -1;
    }
    if (!StringUtils.isBlank(minEvictableIdleTimeMillis)) {
        config.minEvictableIdleTimeMillis = Integer.valueOf(minEvictableIdleTimeMillis);
    } else {
        config.minEvictableIdleTimeMillis = 60000L;
    }
    if (!StringUtils.isBlank(softMinEvictableIdleTimeMillis)) {
        config.softMinEvictableIdleTimeMillis = Integer.valueOf(softMinEvictableIdleTimeMillis);
    }
}
 
开发者ID:m18507308080,项目名称:onolisa,代码行数:55,代码来源:ConfigManager.java

示例12: SSdbPool

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
public SSdbPool(final Config poolConfig, final String hostPortTimeout) {
    this(poolConfig, hostPortTimeout, Protocol.DEFAULT_DATABASE);
}
 
开发者ID:SmallBadFish,项目名称:practice,代码行数:4,代码来源:SSdbPool.java

示例13: test

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
@Test
public void test(){
	JedisPool j = new JedisPool(new Config(),"localhost",6377,1000,"940409",0);
	System.out.println(j.getResource().get("aa"));
	j.getResource().set("java", "haha");
}
 
开发者ID:gsh199449,项目名称:DistributedCrawler,代码行数:7,代码来源:TestJedis.java

示例14: DefaultJedisPool

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
/**
 * 构造方法
 * 
 * @param poolConfig 池配置
 * @param host 主机地址
 * @param port 端口
 * @param timeout 超时时间
 * @param password 密码
 * @param dbIndex 索引
 * @param isMaster 是否是master
 */
public DefaultJedisPool(final Config poolConfig, final String host, int port, int timeout, final String password,
        int dbIndex, boolean isMaster) {
    super(poolConfig, new JedisFactory(host, port, timeout, password, dbIndex));
    this.host = host;
    this.port = port;
    this.dbIndex = dbIndex;
    this.isMaster = isMaster;
}
 
开发者ID:m18507308080,项目名称:onolisa,代码行数:20,代码来源:DefaultJedisPool.java

示例15: NodeInfo4Jedis

import org.apache.commons.pool.impl.GenericObjectPool.Config; //导入依赖的package包/类
/**
 * 构造方法
 * 
 * @param ip Redis服务器ip
 * @param port Redis服务器端口号
 * @param password Redis服务器访问密码
 * @param dbIndex Redis服务器数据库标识,Redis服务器内部使用,相当于数据库的schema
 * @param timeOut 连接超时时间
 * @param config 配置信息
 */
public NodeInfo4Jedis(String ip, Integer port, String password, int dbIndex, int timeOut, Config config) {
    this.ip = ip;
    this.port = port;
    this.password = password;
    this.dbIndex = dbIndex;
    this.timeOut = timeOut;
    this.config = config;
}
 
开发者ID:m18507308080,项目名称:onolisa,代码行数:19,代码来源:NodeInfo4Jedis.java


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