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


Java GenericKeyedObjectPoolConfig.setSoftMinEvictableIdleTimeMillis方法代码示例

本文整理汇总了Java中org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig.setSoftMinEvictableIdleTimeMillis方法的典型用法代码示例。如果您正苦于以下问题:Java GenericKeyedObjectPoolConfig.setSoftMinEvictableIdleTimeMillis方法的具体用法?Java GenericKeyedObjectPoolConfig.setSoftMinEvictableIdleTimeMillis怎么用?Java GenericKeyedObjectPoolConfig.setSoftMinEvictableIdleTimeMillis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig的用法示例。


在下文中一共展示了GenericKeyedObjectPoolConfig.setSoftMinEvictableIdleTimeMillis方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
@Before
public void init() throws InterruptedException {
    this.appKey = "proxytest" + NumUtil.nextNum();
    ServiceFactoryTest serviceFactoryTest = new ServiceFactoryTest();
    ServerArgs serverArgs = serviceFactoryTest.getServerArgs(this.appKey, "127.0.0.1", NumUtil.nextPort());
    ZkRegistry zkRegistry = serviceFactoryTest.getZkRegistry();
    serverArgs.setRegistrys(ImmutableList.of(zkRegistry));

    ThriftServerPublisher publisher = new ThriftServerPublisher(serverArgs);
    Thread thread = new Thread(publisher::init);
    thread.setDaemon(true);
    thread.start();
    TimeUnit.MILLISECONDS.sleep(400);

    poolConfig = new GenericKeyedObjectPoolConfig();
    poolConfig.setMaxTotal(MAX_CONN);
    poolConfig.setMaxTotalPerKey(MAX_CONN);
    poolConfig.setMaxIdlePerKey(MAX_CONN);
    poolConfig.setMinIdlePerKey(MIN_CONN);
    poolConfig.setTestOnBorrow(true);
    poolConfig.setMinEvictableIdleTimeMillis(MINUTES.toMillis(1));
    poolConfig.setSoftMinEvictableIdleTimeMillis(MINUTES.toMillis(1));
    poolConfig.setJmxEnabled(false);
}
 
开发者ID:sofn,项目名称:trpc,代码行数:25,代码来源:TrpcClientProxyTest.java

示例2: init

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
@Before
public void init() throws InterruptedException {
    ServiceFactoryTest serviceFactoryTest = new ServiceFactoryTest();
    ServerArgs serverArgs = serviceFactoryTest.getServerArgs(appKey, "127.0.0.1", port);

    ThriftServerPublisher publisher = new ThriftServerPublisher(serverArgs);
    Thread thread = new Thread(publisher::init);
    thread.setDaemon(true);
    thread.start();
    TimeUnit.MILLISECONDS.sleep(400);

    poolConfig = new GenericKeyedObjectPoolConfig();
    poolConfig.setMaxTotal(MAX_CONN);
    poolConfig.setMaxTotalPerKey(MAX_CONN);
    poolConfig.setMaxIdlePerKey(MAX_CONN);
    poolConfig.setMinIdlePerKey(MIN_CONN);
    poolConfig.setTestOnBorrow(true);
    poolConfig.setMinEvictableIdleTimeMillis(MINUTES.toMillis(1));
    poolConfig.setSoftMinEvictableIdleTimeMillis(MINUTES.toMillis(1));
    poolConfig.setJmxEnabled(false);
}
 
开发者ID:sofn,项目名称:trpc,代码行数:22,代码来源:StaticMonitorTest.java

示例3: getColorSpacePoolConfig

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
public GenericKeyedObjectPoolConfig getColorSpacePoolConfig() {
	GenericKeyedObjectPoolConfig result = new GenericKeyedObjectPoolConfig();
	if (colorSpacePoolMaxTotal != null) {
		result.setMaxTotal(colorSpacePoolMaxTotal);
	}
	if (colorSpacePoolMaxPerKey != null) {
		result.setMaxTotalPerKey(colorSpacePoolMaxPerKey);
	}
	if (colorSpacePoolMaxIdlePerKey != null) {
		result.setMaxIdlePerKey(colorSpacePoolMaxIdlePerKey);
	}
	if (colorSpacePoolMinIdlePerKey != null) {
		result.setMinIdlePerKey(colorSpacePoolMinIdlePerKey);
	}
	if (colorSpacePoolMaxWait != null) {
		result.setMaxWaitMillis(colorSpacePoolMaxWait);
	}
	if (colorSpacePoolMinEvictableIdleTime != null) {
		result.setMinEvictableIdleTimeMillis(colorSpacePoolMinEvictableIdleTime);
	}
	if (colorSpacePoolSoftMinEvictableIdleTime != null) {
		result.setSoftMinEvictableIdleTimeMillis(colorSpacePoolSoftMinEvictableIdleTime);
	}
	if (colorSpacePoolTimeBetweenEvictionRuns != null) {
		result.setTimeBetweenEvictionRunsMillis(colorSpacePoolTimeBetweenEvictionRuns);
	}
	if (colorSpacePoolBlockWhenExhausted != null) {
		result.setBlockWhenExhausted(colorSpacePoolBlockWhenExhausted);
	}
	return result;
}
 
开发者ID:marrow16,项目名称:ColorConverter,代码行数:32,代码来源:Configuration.java

示例4: init

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
@Before
public void init() {
    this.port = RandomUtils.nextInt(10000, 20000);
    new DemoServer().startDaemon(this.port);

    config = new GenericKeyedObjectPoolConfig();
    config.setMaxTotal(MAX_CONN);
    config.setMaxTotalPerKey(MAX_CONN);
    config.setMaxIdlePerKey(MAX_CONN);
    config.setMinIdlePerKey(MIN_CONN);
    config.setTestOnBorrow(true);
    config.setMinEvictableIdleTimeMillis(MINUTES.toMillis(1));
    config.setSoftMinEvictableIdleTimeMillis(MINUTES.toMillis(1));
    config.setJmxEnabled(false);
}
 
开发者ID:sofn,项目名称:trpc,代码行数:16,代码来源:TrpcClientPoolTest.java

示例5: registerPool

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
private void registerPool(final String username, final String password)
        throws NamingException, SQLException {

    final ConnectionPoolDataSource cpds = testCPDS(username, password);

    // Create an object pool to contain our PooledConnections
    factory = new KeyedCPDSConnectionFactory(cpds, getValidationQuery(),
            getValidationQueryTimeout(), isRollbackAfterValidation());
    factory.setMaxConnLifetimeMillis(getMaxConnLifetimeMillis());

    final GenericKeyedObjectPoolConfig config =
            new GenericKeyedObjectPoolConfig();
    config.setBlockWhenExhausted(getDefaultBlockWhenExhausted());
    config.setEvictionPolicyClassName(getDefaultEvictionPolicyClassName());
    config.setLifo(getDefaultLifo());
    config.setMaxIdlePerKey(getDefaultMaxIdle());
    config.setMaxTotal(getMaxTotal());
    config.setMaxTotalPerKey(getDefaultMaxTotal());
    config.setMaxWaitMillis(getDefaultMaxWaitMillis());
    config.setMinEvictableIdleTimeMillis(
            getDefaultMinEvictableIdleTimeMillis());
    config.setMinIdlePerKey(getDefaultMinIdle());
    config.setNumTestsPerEvictionRun(getDefaultNumTestsPerEvictionRun());
    config.setSoftMinEvictableIdleTimeMillis(
            getDefaultSoftMinEvictableIdleTimeMillis());
    config.setTestOnCreate(getDefaultTestOnCreate());
    config.setTestOnBorrow(getDefaultTestOnBorrow());
    config.setTestOnReturn(getDefaultTestOnReturn());
    config.setTestWhileIdle(getDefaultTestWhileIdle());
    config.setTimeBetweenEvictionRunsMillis(
            getDefaultTimeBetweenEvictionRunsMillis());

    final KeyedObjectPool<UserPassKey,PooledConnectionAndInfo> tmpPool =
            new GenericKeyedObjectPool<>(factory, config);
    factory.setPool(tmpPool);
    pool = tmpPool;
}
 
开发者ID:apache,项目名称:commons-dbcp,代码行数:38,代码来源:SharedPoolDataSource.java

示例6: getConfig

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
private GenericKeyedObjectPoolConfig getConfig(PoolConfig poolConfig) {
	GenericKeyedObjectPoolConfig objectPoolConfig = new GenericKeyedObjectPoolConfig();

	objectPoolConfig.setMaxTotalPerKey(poolConfig.getMaxTotalPerKey());
	objectPoolConfig.setMaxTotal(poolConfig.getMaxTotal());

	objectPoolConfig.setMaxIdlePerKey(poolConfig.getMaxIdlePerKey());
	objectPoolConfig.setMinIdlePerKey(poolConfig.getMinIdlePerKey());

	objectPoolConfig.setTestWhileIdle(poolConfig.isTestWhileIdle());
	objectPoolConfig.setTestOnReturn(poolConfig.isTestOnReturn());
	objectPoolConfig.setTestOnCreate(poolConfig.isTestOnCreate());
	objectPoolConfig.setTestOnBorrow(poolConfig.isTestOnBorrow());

	objectPoolConfig.setTimeBetweenEvictionRunsMillis(poolConfig.getTimeBetweenEvictionRunsMillis());
	objectPoolConfig.setEvictionPolicyClassName(poolConfig.getEvictionPolicyClassName());
	objectPoolConfig.setMinEvictableIdleTimeMillis(poolConfig.getMinEvictableIdleTimeMillis());
	objectPoolConfig.setNumTestsPerEvictionRun(poolConfig.getNumTestsPerEvictionRun());
	objectPoolConfig.setSoftMinEvictableIdleTimeMillis(poolConfig.getSoftMinEvictableIdleTimeMillis());

	objectPoolConfig.setJmxEnabled(poolConfig.isJmxEnabled());
	objectPoolConfig.setJmxNameBase(poolConfig.getJmxNameBase());
	objectPoolConfig.setJmxNamePrefix(poolConfig.getJmxNamePrefix());

	objectPoolConfig.setMaxWaitMillis(poolConfig.getMaxWaitMillis());

	objectPoolConfig.setFairness(poolConfig.isFairness());
	objectPoolConfig.setBlockWhenExhausted(poolConfig.isBlockWhenExhausted());
	objectPoolConfig.setLifo(poolConfig.isLifo());

	return objectPoolConfig;
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:33,代码来源:PooledContextSource.java

示例7: initTrackerConfig

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
private void initTrackerConfig(Config cf) {
    GenericKeyedObjectPoolConfig pc = new GenericKeyedObjectPoolConfig();

    pc.setLifo(cf.getBooleanValue("pool.tracker.lifo", true));
    pc.setMaxTotalPerKey(cf.getIntValue("pool.tracker.maxTotal", 10));
    pc.setMinIdlePerKey(cf.getIntValue("pool.tracker.minIdle", 2));
    pc.setMaxIdlePerKey(cf.getIntValue("pool.tracker.maxIdle", 4));
    pc.setMaxWaitMillis(cf.getIntValue("pool.tracker.maxWaitMillis", 10 * 1000));
    pc.setSoftMinEvictableIdleTimeMillis(cf.getIntValue("pool.tracker.softMinEvictableIdleTimeMillis",
            1000 * 60 * 2));
    pc.setTestWhileIdle(cf.getBooleanValue("pool.tracker.testWhileIdle", true));
    pc.setTimeBetweenEvictionRunsMillis(cf.getIntValue("pool.tracker.timeBetweenEvictionRunsMillis", 1000 * 12));
    pc.setMinEvictableIdleTimeMillis(cf.getIntValue("pool.tracker.minEvictableIdleTimeMillis", 1000 * 60 * 5));

    trackerServers = new FdfsKeyedObjectPool<PooledTrackerServer>(new PooledServerFactory<PooledTrackerServer>() {
        @Override
        public PooledTrackerServer create(InetSocketAddress address) throws IOException {

            PooledTrackerServer srv = new PooledTrackerServer(address);

            if (log.isDebugEnabled()) {
                log.debug(String.format("create tracker server:%s address:%X", address.toString(), srv.hashCode()));
            }

            return srv;
        }
    }, pc);
}
 
开发者ID:fanyunfeng,项目名称:jfdfslib,代码行数:29,代码来源:PooledFdfsServerFactory.java

示例8: initStorageConfig

import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; //导入方法依赖的package包/类
private void initStorageConfig(Config cf) {
    GenericKeyedObjectPoolConfig pc = new GenericKeyedObjectPoolConfig();

    pc.setLifo(cf.getBooleanValue("pool.storage.lifo", true));
    pc.setMaxTotalPerKey(cf.getIntValue("pool.storage.maxTotal", 20));
    pc.setMinIdlePerKey(cf.getIntValue("pool.storage.minIdle", 2));
    pc.setMaxIdlePerKey(cf.getIntValue("pool.storage.maxIdle", 8));
    pc.setMaxWaitMillis(cf.getIntValue("pool.storage.maxWaitMillis", 10 * 1000));
    pc.setSoftMinEvictableIdleTimeMillis(cf.getIntValue("pool.storage.softMinEvictableIdleTimeMillis",
            1000 * 60 * 2));
    pc.setTestWhileIdle(cf.getBooleanValue("pool.storage.testWhileIdle", true));
    pc.setTimeBetweenEvictionRunsMillis(cf.getIntValue("pool.storage.timeBetweenEvictionRunsMillis", 1000 * 12));
    pc.setMinEvictableIdleTimeMillis(cf.getIntValue("pool.storage.minEvictableIdleTimeMillis", 1000 * 60 * 3));

    storageServers = new FdfsKeyedObjectPool<PooledStorageServer>(new PooledServerFactory<PooledStorageServer>() {
        @Override
        public PooledStorageServer create(InetSocketAddress address) throws IOException {

            PooledStorageServer srv = new PooledStorageServer(address, 0);

            if (log.isDebugEnabled()) {
                log.debug(String.format("create storge server:%s address:%X", address.toString(), srv.hashCode()));
            }

            return srv;
        }
    }, pc);
}
 
开发者ID:fanyunfeng,项目名称:jfdfslib,代码行数:29,代码来源:PooledFdfsServerFactory.java


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