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


Java AbandonedConfig.setRemoveAbandonedOnMaintenance方法代码示例

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


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

示例1: getAbandonedConfig

import org.apache.commons.pool2.impl.AbandonedConfig; //导入方法依赖的package包/类
public AbandonedConfig getAbandonedConfig() {
    AbandonedConfig abandonedConfig = new AbandonedConfig();
    abandonedConfig.setRemoveAbandonedOnBorrow(this.removeAbandonedOnBorrow);
    abandonedConfig.setRemoveAbandonedTimeout(this.removeAbandonedTimeout);
    abandonedConfig.setRemoveAbandonedOnMaintenance(this.removeAbandonedOnMaintenance);
    return abandonedConfig;
}
 
开发者ID:carryxyh,项目名称:FKC,代码行数:8,代码来源:KryoPoolConfig.java

示例2: JedisPool

import org.apache.commons.pool2.impl.AbandonedConfig; //导入方法依赖的package包/类
public JedisPool(final JedisPoolConfig poolConfig, final String host, final int port, final int timeout, String password) {
	super(poolConfig, host, port, timeout, formatPassword(password));
	this.initRedisConnectionListener(poolConfig, host, port, timeout);

	AbandonedConfig abandonedConfig = new AbandonedConfig();
	abandonedConfig.setRemoveAbandonedTimeout(10);
	abandonedConfig.setRemoveAbandonedOnBorrow(true);
	abandonedConfig.setRemoveAbandonedOnMaintenance(true);
	internalPool.setAbandonedConfig(abandonedConfig);
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:11,代码来源:JedisPool.java

示例3: DataLoaderFactory

import org.apache.commons.pool2.impl.AbandonedConfig; //导入方法依赖的package包/类
private DataLoaderFactory() {
    GenericObjectPoolConfig config=new GenericObjectPoolConfig();
    config.setMaxTotal(1024);
    config.setMaxIdle(50);
    config.setMinIdle(8);
    config.setBlockWhenExhausted(false);// 当Pool中没有对象时不等待,而是直接new个新的

    AbandonedConfig abandonConfig=new AbandonedConfig();
    abandonConfig.setRemoveAbandonedTimeout(300);
    abandonConfig.setRemoveAbandonedOnBorrow(true);
    abandonConfig.setRemoveAbandonedOnMaintenance(true);
    factory=new GenericObjectPool<DataLoader>(this, config, abandonConfig);
}
 
开发者ID:qiujiayu,项目名称:AutoLoadCache,代码行数:14,代码来源:DataLoaderFactory.java

示例4: init

import org.apache.commons.pool2.impl.AbandonedConfig; //导入方法依赖的package包/类
public void init() {
    if (getContextPool() == null) {
        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        PoolConfig.setConfig(config, "ldap.context.pool", "ldap.context.pool.", "global.pool.");
        config.setTestOnBorrow(true);
        LdapServiceContextPoolFactory serviceContextPoolFactory = new LdapServiceContextPoolFactory(getConstantsConfig());
        setContextPool(new GenericObjectPool<>(serviceContextPoolFactory, config));
        AbandonedConfig abandonedConfig = new AbandonedConfig();
        abandonedConfig.setUseUsageTracking(true);
        abandonedConfig.setRemoveAbandonedOnMaintenance(true);
        abandonedConfig.setRemoveAbandonedOnBorrow(true);
        abandonedConfig.setRemoveAbandonedTimeout(60);
        getContextPool().setAbandonedConfig(abandonedConfig);
    }
}
 
开发者ID:rancher,项目名称:cattle,代码行数:16,代码来源:LDAPIdentityProvider.java

示例5: ThriftClientPool

import org.apache.commons.pool2.impl.AbandonedConfig; //导入方法依赖的package包/类
/**
 * Initializes a new ThriftClientPool.
 *
 * @param configuration The properties for this instance of the pool
 */
public ThriftClientPool(Properties configuration) {
    this.configuration = new EzProperties(configuration, true);
    /* We only need to use this to get the application name, so we want this to fall out of scope and get garbage
     collected */
    EzBakeApplicationConfigurationHelper appConfig = new EzBakeApplicationConfigurationHelper(configuration);
    this.applicationName = appConfig.getApplicationName();
    this.applicationSecurityId = appConfig.getSecurityID();
    if (Strings.isNullOrEmpty(applicationName)) {
        logger.warn("No application name was found.  Only common services will be discoverable");
    }

    this.thriftConfiguration = new ThriftConfigurationHelper(configuration);

    poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMaxIdle(thriftConfiguration.getMaxIdleClients());
    poolConfig.setMaxTotal(thriftConfiguration.getMaxPoolClients());
    poolConfig.setMinEvictableIdleTimeMillis(thriftConfiguration.getMillisIdleBeforeEviction());
    poolConfig.setTimeBetweenEvictionRunsMillis(thriftConfiguration.getMillisIdleBeforeEviction());
    poolConfig.setTestOnBorrow(thriftConfiguration.getTestOnBorrow());
    poolConfig.setTestWhileIdle(thriftConfiguration.getTestWhileIdle());
    poolConfig.setBlockWhenExhausted(thriftConfiguration.getBlockWhenExhausted());

    abandonedConfig = new AbandonedConfig();
    abandonedConfig.setLogAbandoned(thriftConfiguration.getLogAbandoned());
    abandonedConfig.setRemoveAbandonedOnBorrow(thriftConfiguration.getRemoveAbandonedOnBorrow());
    abandonedConfig.setRemoveAbandonedOnMaintenance(thriftConfiguration.getRemoveAbandonedOnMaintenance());
    abandonedConfig.setRemoveAbandonedTimeout(thriftConfiguration.getRemoveAbandonedTimeout());

    if(!thriftConfiguration.actuallyPoolClients()) {
        logger.info("Thrift client pool is NOT actually pooling clients!");
    }

    ServiceDiscovery serviceDiscoveryClient = getServiceDiscoveryClient();
    try {
        this.commonServices.addAll(serviceDiscoveryClient.getServices());
    } catch(Exception e) {
        logger.warn("Could not obtain common services!");
        throw new RuntimeException(e);
    }

    RefreshEndpoints(serviceDiscoveryClient);
    RefreshCommonEndpoints(serviceDiscoveryClient);
    closeClient(serviceDiscoveryClient);
}
 
开发者ID:ezbake,项目名称:ezbake-common-java,代码行数:50,代码来源:ThriftClientPool.java

示例6: createDbcp

import org.apache.commons.pool2.impl.AbandonedConfig; //导入方法依赖的package包/类
private void createDbcp(DbcpConfig conf)
{
	if (!dataSources.containsKey(conf.name))
	{
		try
	    {
			
			Class.forName(conf.driverClassName);
		    
		    DriverManagerConnectionFactory cf =  new DriverManagerConnectionFactory(conf.jdbc,conf.user,conf.password);
		    
		    PoolableConnectionFactory pcf  =  new PoolableConnectionFactory(cf,null);
		    pcf.setValidationQuery(conf.validationQuery);
		    //, pool, null, conf.validationQuery, false, true,abandondedConfig);
			
		    logger.info("Creating pool "+conf.toString());
		    // create a generic pool
		    GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<PoolableConnection>(pcf);
		    pool.setMaxTotal(conf.maxTotal);
		    pool.setMaxIdle(conf.maxIdle);
		    pool.setMinIdle(conf.minIdle);
		    pool.setMaxWaitMillis(conf.maxWait);
		    pool.setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis);
		    pool.setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis);
		    pool.setTestWhileIdle(conf.testWhileIdle);
		    pool.setTestOnBorrow(conf.testOnBorrow);
	    
		    AbandonedConfig abandonedConfig = new AbandonedConfig();
		    abandonedConfig.setRemoveAbandonedOnMaintenance(conf.removeAbanadoned);
		    abandonedConfig.setRemoveAbandonedTimeout(conf.removeAbandonedTimeout);
		    abandonedConfig.setLogAbandoned(conf.logAbandonded);
	    
		    pool.setAbandonedConfig(abandonedConfig);
	    
		    pcf.setPool(pool);
		    DataSource ds = new PoolingDataSource(pool);
		    dataSources.put(conf.name, ds);

	    } catch (ClassNotFoundException e) {
			logger.error("Failed to create datasource for "+conf.name+ " with class "+conf.driverClassName);
		}
	   
	}
	else
	{
		logger.error("Pool "+conf.name+" already exists. Can't change existing datasource at present.");
	}
}
 
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:49,代码来源:DbcpFactory.java


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