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


Java PoolProperties.setMinIdle方法代码示例

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


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

示例1: TomcatSchema

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
public TomcatSchema(@Nonnull Config config) {
	checkNotNull(config);

	log.debug("{} sql.url: {}", config.getName(), config.getString("sql.url"));

	PoolProperties poolProps = new PoolProperties();
	poolProps.setUrl(config.getString("sql.url"));
	poolProps.setUsername(config.getString("sql.login"));
	poolProps.setPassword(config.getString("sql.password"));
	poolProps.setDriverClassName(config.getString("sql.driver"));
	poolProps.setMinIdle(config.getInt("sql.pool.minIdle", 1));
	poolProps.setMaxIdle(config.getInt("sql.pool.maxIdle", 3));
	poolProps.setMaxActive(config.getInt("sql.pool.maxActive", 5));
	poolProps.setInitialSize(poolProps.getMinIdle());
	poolProps.setValidationQuery("SELECT 1");
	poolProps.setValidationQueryTimeout((int) config.getTime("sql.pool.validationQueryTimeout", "5s"));
	poolProps.setTestOnBorrow(config.getBoolean("sql.pool.testOnBorrow", true));
	poolProps.setDefaultReadOnly(config.getBoolean("sql.pool.defaultReadOnly", true));
	dataSource = new DataSource(poolProps);
	streaming = config.getBoolean("sql.streaming", false);
}
 
开发者ID:lithiumtech,项目名称:flow,代码行数:22,代码来源:TomcatSchema.java

示例2: initDataSource

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
private void initDataSource(String dataSourceFile) {
    Properties dataSourceProps = getPropertiesFromClasspath(dataSourceFile);
    PoolProperties p = new PoolProperties();
    p.setUrl(dataSourceProps.getProperty("url"));
    p.setDriverClassName(dataSourceProps.getProperty("driverClassName"));
    p.setUsername(dataSourceProps.getProperty("username"));
    p.setPassword(dataSourceProps.getProperty("password"));
    p.setMaxIdle(Integer.valueOf(dataSourceProps.getProperty("maxIdle")));
    p.setMinIdle(Integer.valueOf(dataSourceProps.getProperty("minIdle")));
    p.setInitialSize(Integer.valueOf(dataSourceProps.getProperty("initialSize")));
    p.setMaxWait(Integer.valueOf(dataSourceProps.getProperty("maxWait")));
    p.setMaxActive(Integer.valueOf(dataSourceProps.getProperty("maxActive")));
    p.setTestOnBorrow(Boolean.valueOf(dataSourceProps.getProperty("testOnBorrow")));
    p.setTestOnReturn(Boolean.valueOf(dataSourceProps.getProperty("testOnReturn")));
    p.setTestWhileIdle(Boolean.valueOf(dataSourceProps.getProperty("testWhileIdle")));
    p.setValidationQuery(dataSourceProps.getProperty("validationQuery"));
    p.setValidationQueryTimeout(Integer.valueOf(dataSourceProps.getProperty("validationQueryTimeout")));
    p.setTimeBetweenEvictionRunsMillis(Integer.valueOf(dataSourceProps.getProperty("timeBetweenEvictionRunsMillis")));
    p.setMinEvictableIdleTimeMillis(Integer.valueOf(dataSourceProps.getProperty("minEvictableIdleTimeMillis")));
    p.setRemoveAbandoned(Boolean.valueOf(dataSourceProps.getProperty("removeAbandoned")));
    p.setRemoveAbandonedTimeout(Integer.valueOf(dataSourceProps.getProperty("removeAbandonedTimeout")));
    p.setValidationInterval(Integer.valueOf(dataSourceProps.getProperty("validationInterval")));
    p.setLogAbandoned(Boolean.valueOf(dataSourceProps.getProperty("logAbandoned")));
    p.setFairQueue(Boolean.valueOf(dataSourceProps.getProperty("fairQueue")));
    dataSource.setPoolProperties(p);
}
 
开发者ID:edgar615,项目名称:javase-study,代码行数:27,代码来源:DaoManager.java

示例3: dataSource

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
@Primary
@Bean
public DataSource dataSource() {
    DbConfiguration dbConfiguration = configurationService.getDbConfiguration();

    PoolProperties poolProperties = new PoolProperties();
    poolProperties.setDriverClassName(dbConfiguration.getDriverClassName());
    poolProperties.setUrl(dbConfiguration.getUrl());
    poolProperties.setUsername(dbConfiguration.getUser());
    poolProperties.setPassword(dbConfiguration.getPassword());
    poolProperties.setMaxActive(dbConfiguration.getMaxActive());
    poolProperties.setMaxIdle(dbConfiguration.getMaxIdle());
    poolProperties.setMinIdle(dbConfiguration.getMinIdle());
    poolProperties.setMaxWait(dbConfiguration.getMaxWait());
    poolProperties.setValidationQuery(dbConfiguration.getValidationQuery());
    poolProperties.setTestOnBorrow(dbConfiguration.getTestOnBorrow());
    poolProperties.setTestWhileIdle(dbConfiguration.getTestWhileIdle());

    return new org.apache.tomcat.jdbc.pool.DataSource(poolProperties);

}
 
开发者ID:mcgray,项目名称:Medium-test-poc,代码行数:22,代码来源:DataSourceConfiguration.java

示例4: getPoolProperties

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
public PoolProperties getPoolProperties() {
    PoolProperties poolProperties = new PoolProperties();
    poolProperties.setUrl("jdbc:postgresql://localhost:5432/chronica");
    poolProperties.setDriverClassName("org.postgresql.Driver");
    poolProperties.setUsername("chronica");
    poolProperties.setPassword("chronica");
    poolProperties.setJmxEnabled(true);
    poolProperties.setTestWhileIdle(false);
    poolProperties.setTestOnBorrow(true);
    poolProperties.setValidationQuery("SELECT 1");
    poolProperties.setTestOnReturn(false);
    poolProperties.setValidationInterval(30000);
    poolProperties.setTimeBetweenEvictionRunsMillis(30000);
    poolProperties.setMaxActive(100);
    poolProperties.setInitialSize(10);
    poolProperties.setMaxWait(10000);
    poolProperties.setRemoveAbandonedTimeout(60);
    poolProperties.setMinEvictableIdleTimeMillis(30000);
    poolProperties.setMinIdle(10);
    poolProperties.setLogAbandoned(true);
    poolProperties.setRemoveAbandoned(true);
    poolProperties.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"
            + "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
    return poolProperties;
}
 
开发者ID:evanx,项目名称:chronic,代码行数:26,代码来源:ChronicProperties.java

示例5: getTomcatDataSource

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
/**
 * Tomcat DataSource 를 빌드합니다.
 *
 * @param driverClass the driver class
 * @param url         the url
 * @param username    the username
 * @param passwd      the passwd
 * @return the tomcat kr.hconnect.data source
 */
protected DataSource getTomcatDataSource(String driverClass, String url, String username, String passwd) {

	PoolProperties p = new PoolProperties();
	p.setUrl(url);
	p.setDriverClassName(driverClass);
	p.setUsername(username);
	p.setPassword(passwd);

	p.setJmxEnabled(true);
	p.setTestWhileIdle(true);
	p.setTestOnBorrow(true);
	p.setValidationQuery("SELECT 1");
	p.setTestOnReturn(false);
	p.setValidationInterval(30000);
	p.setTimeBetweenEvictionRunsMillis(30000);
	p.setMaxActive(200);
	p.setInitialSize(10);
	p.setMaxWait(10000);
	p.setRemoveAbandonedTimeout(60);
	p.setMinEvictableIdleTimeMillis(30000);
	p.setMinIdle(10);

	return new org.apache.tomcat.jdbc.pool.DataSource(p);
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:34,代码来源:JpaConfigBase.java

示例6: getTomcatDataSource

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
/**
 * Tomcat DataSource 를 빌드합니다.
 *
 * @param driverClass the driver class
 * @param url         the url
 * @param username    the username
 * @param passwd      the passwd
 * @return the tomcat kr.hconnect.data source
 */
protected DataSource getTomcatDataSource(String driverClass, String url, String username, String passwd) {

	PoolProperties p = new org.apache.tomcat.jdbc.pool.PoolProperties();
	p.setUrl(url);
	p.setDriverClassName(driverClass);
	p.setUsername(username);
	p.setPassword(passwd);

	p.setJmxEnabled(true);
	p.setTestWhileIdle(true);
	p.setTestOnBorrow(true);
	p.setValidationQuery("SELECT 1");
	p.setTestOnReturn(false);
	p.setValidationInterval(30000);
	p.setTimeBetweenEvictionRunsMillis(30000);
	p.setMaxActive(200);
	p.setInitialSize(10);
	p.setMaxWait(10000);
	p.setRemoveAbandonedTimeout(60);
	p.setMinEvictableIdleTimeMillis(30000);
	p.setMinIdle(10);

	return new org.apache.tomcat.jdbc.pool.DataSource(p);
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:34,代码来源:JpaConfigBase.java

示例7: createPool

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
public static void createPool() throws Exception {
// Modify this code in order to extract a Connection from your
// connection pooling system:

// Driver parameters to use:
String driverClassName = "org.postgresql.Driver";
String url = "jdbc:postgresql://localhost:5432/kawansoft_example";
String username = "user1";
String password = "password1";

// Creating the DataSource bean and populating the values:
// Mandatory values to set
PoolProperties p = new PoolProperties();
p.setDriverClassName(driverClassName);
p.setUrl(url);
p.setUsername(username);
p.setPassword(password);

// Other possible values to set
p.setTestOnBorrow(true);
p.setValidationQuery("SELECT 1");
p.setTestOnReturn(false);
p.setValidationInterval(30000);
p.setTimeBetweenEvictionRunsMillis(30000);
p.setMaxActive(2);
p.setInitialSize(2);
p.setMaxWait(10000);
p.setRemoveAbandonedTimeout(60);
p.setMinEvictableIdleTimeMillis(30000);
p.setMinIdle(2);
p.setMaxIdle(2);
p.setLogAbandoned(true);
p.setRemoveAbandoned(true);
p.setJdbcInterceptors("ConnectionState;StatementFinalizer");

dataSource = new DataSource();
dataSource.setPoolProperties(p);

   }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:40,代码来源:TestTomcatJdbcPoolBehavior.java

示例8: dataSource

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
@Bean
public DataSource dataSource() {
    LOGGER.info("Starting ACS with the database connection: '{}'.", this.url); //$NON-NLS-1$
    PoolProperties poolProperties = new PoolProperties();
    poolProperties.setDriverClassName(this.driverClassName);
    poolProperties.setUrl(this.url);
    poolProperties.setUsername(this.username);
    poolProperties.setPassword(this.password);
    poolProperties.setMaxActive(this.maxActive);
    poolProperties.setMinIdle(this.minActive);
    poolProperties.setMaxWait(this.maxWaitTime);
    return new org.apache.tomcat.jdbc.pool.DataSource(poolProperties);
}
 
开发者ID:eclipse,项目名称:keti,代码行数:14,代码来源:EnvDataSourceConfig.java

示例9: getDatabasePoolConfig

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
public DatabasePoolConfig getDatabasePoolConfig(String name) {
    DataSourceConfigure configure = DataSourceConfigureLocator.getInstance().getDataSourceConfigure(name);
    PoolProperties poolProperties = new PoolProperties();

    poolProperties.setTestWhileIdle(configure.getBooleanProperty(TESTWHILEIDLE, DEFAULT_TESTWHILEIDLE));
    poolProperties.setTestOnBorrow(configure.getBooleanProperty(TESTONBORROW, DEFAULT_TESTONBORROW));
    poolProperties.setTestOnReturn(configure.getBooleanProperty(TESTONRETURN, DEFAULT_TESTONRETURN));

    poolProperties.setValidationQuery(configure.getProperty(VALIDATIONQUERY, DEFAULT_VALIDATIONQUERY));
    poolProperties.setValidationQueryTimeout(
            configure.getIntProperty(VALIDATIONQUERYTIMEOUT, DEFAULT_VALIDATIONQUERYTIMEOUT));
    poolProperties.setValidationInterval(configure.getLongProperty(VALIDATIONINTERVAL, DEFAULT_VALIDATIONINTERVAL));

    poolProperties.setTimeBetweenEvictionRunsMillis(
            configure.getIntProperty(TIMEBETWEENEVICTIONRUNSMILLIS, DEFAULT_TIMEBETWEENEVICTIONRUNSMILLIS));
    poolProperties.setMinEvictableIdleTimeMillis(DEFAULT_MINEVICTABLEIDLETIMEMILLIS);

    poolProperties.setMaxAge(configure.getIntProperty(MAX_AGE, DEFAULT_MAXAGE));
    poolProperties.setMaxActive(configure.getIntProperty(MAXACTIVE, DEFAULT_MAXACTIVE));
    poolProperties.setMinIdle(configure.getIntProperty(MINIDLE, DEFAULT_MINIDLE));
    poolProperties.setMaxWait(configure.getIntProperty(MAXWAIT, DEFAULT_MAXWAIT));
    poolProperties.setInitialSize(configure.getIntProperty(INITIALSIZE, DEFAULT_INITIALSIZE));

    poolProperties.setRemoveAbandonedTimeout(
            configure.getIntProperty(REMOVEABANDONEDTIMEOUT, DEFAULT_REMOVEABANDONEDTIMEOUT));
    poolProperties.setRemoveAbandoned(configure.getBooleanProperty(REMOVEABANDONED, DEFAULT_REMOVEABANDONED));
    poolProperties.setLogAbandoned(configure.getBooleanProperty(LOGABANDONED, DEFAULT_LOGABANDONED));

    poolProperties
            .setConnectionProperties(configure.getProperty(CONNECTIONPROPERTIES, DEFAULT_CONNECTIONPROPERTIES));
    poolProperties.setValidatorClassName(configure.getProperty(VALIDATORCLASSNAME, DEFAULT_VALIDATORCLASSNAME));

    poolProperties.setJmxEnabled(DEFAULT_JMXENABLED);
    poolProperties.setJdbcInterceptors(DEFAULT_JDBCINTERCEPTORS);

    return new DatabasePoolConfig(poolProperties);
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:38,代码来源:DatabasePoolConfigParser.java

示例10: createDataSource

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
private static DataSource createDataSource(String url, String userName, String password, String driverClass)
        throws Exception {
    PoolProperties p = new PoolProperties();

    p.setUrl(url);
    p.setUsername(userName);
    p.setPassword(password);
    p.setDriverClassName(driverClass);
    p.setJmxEnabled(false);
    p.setTestWhileIdle(false);
    p.setTestOnBorrow(true);
    p.setTestOnReturn(false);
    p.setValidationQuery("SELECT 1");
    p.setValidationQueryTimeout(5);
    p.setValidationInterval(30000L);
    p.setTimeBetweenEvictionRunsMillis(5000);
    p.setMaxActive(100);
    p.setMinIdle(0);
    p.setMaxWait(10000);
    p.setMaxAge(0L);
    p.setInitialSize(1);
    p.setRemoveAbandonedTimeout(60);
    p.setRemoveAbandoned(true);
    p.setLogAbandoned(true);
    p.setMinEvictableIdleTimeMillis(30000);
    p.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"
            + "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");

    org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(p);
    ds.createPool();
    return ds;
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:33,代码来源:DataSourceUtil.java

示例11: getTomcatDataSourceWithDriverClassName

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
private static DataSource getTomcatDataSourceWithDriverClassName() {
    PoolProperties poolProperties = new PoolProperties();
    poolProperties.setUrl(URL + ";TEST=TOMCAT_WITH_CLASSNAME"); // append a dummy URL element to ensure different DB per test
    poolProperties.setValidationQuery("SELECT 1");
    poolProperties.setMinIdle(3);
    poolProperties.setMaxActive(10);
    poolProperties.setDriverClassName(ContainerDatabaseDriver.class.getName());

    return new org.apache.tomcat.jdbc.pool.DataSource(poolProperties);
}
 
开发者ID:testcontainers,项目名称:testcontainers-java,代码行数:11,代码来源:JDBCDriverWithPoolTest.java

示例12: setUp

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
@Before
public void setUp() {
    PoolProperties p = new PoolProperties();
    p.setUrl("jdbc:mysql://localhost:3306/mysql");
    p.setDriverClassName("com.mysql.jdbc.Driver");
    p.setUsername("root");
    p.setPassword("");
    p.setJmxEnabled(true);
    p.setTestWhileIdle(false);
    p.setTestOnBorrow(true);
    p.setValidationQuery("SELECT 1");
    p.setTestOnReturn(false);
    p.setValidationInterval(30000);
    p.setTimeBetweenEvictionRunsMillis(30000);
    p.setMaxActive(100);
    p.setInitialSize(10);
    p.setMaxWait(10000);
    p.setRemoveAbandonedTimeout(60);
    p.setMinEvictableIdleTimeMillis(30000);
    p.setMinIdle(10);
    p.setLogAbandoned(true);
    p.setRemoveAbandoned(true);
    p.setFairQueue(true);
    p.setJdbcInterceptors(
            "org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;" +
                    "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
    dataSource = new DataSource();
    dataSource.setPoolProperties(p);
}
 
开发者ID:edgar615,项目名称:javase-study,代码行数:30,代码来源:DataSourceTest.java

示例13: setUp

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
@Before
public void setUp() {
    PoolProperties p = new PoolProperties();
    p.setUrl("jdbc:mysql://localhost:3306/admin");
    p.setDriverClassName("com.mysql.jdbc.Driver");
    p.setUsername("root");
    p.setPassword("");
    p.setJmxEnabled(true);
    p.setTestWhileIdle(false);
    p.setTestOnBorrow(true);
    p.setValidationQuery("SELECT 1");
    p.setTestOnReturn(false);
    p.setValidationInterval(30000);
    p.setTimeBetweenEvictionRunsMillis(30000);
    p.setMaxActive(100);
    p.setInitialSize(10);
    p.setMaxWait(10000);
    p.setRemoveAbandonedTimeout(60);
    p.setMinEvictableIdleTimeMillis(30000);
    p.setMinIdle(10);
    p.setLogAbandoned(true);
    p.setRemoveAbandoned(true);
    p.setFairQueue(true);
    p.setJdbcInterceptors(
            "org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;" +
                    "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
    dataSource = new DataSource();
    dataSource.setPoolProperties(p);
}
 
开发者ID:edgar615,项目名称:javase-study,代码行数:30,代码来源:DbUtilsTest.java

示例14: setUp

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
@Before
public void setUp() {
    PoolProperties p = new PoolProperties();
    p.setUrl("jdbc:mysql://127.0.0.1:3308/admin");
    p.setDriverClassName("com.mysql.jdbc.Driver");
    p.setUsername("root");
    p.setPassword("");
    p.setJmxEnabled(true);
    p.setTestWhileIdle(false);
    p.setTestOnBorrow(true);
    p.setValidationQuery("SELECT 1");
    p.setTestOnReturn(false);
    p.setValidationInterval(30000);
    p.setTimeBetweenEvictionRunsMillis(30000);
    p.setMaxActive(100);
    p.setInitialSize(10);
    p.setMaxWait(10000);
    p.setRemoveAbandonedTimeout(60);
    p.setMinEvictableIdleTimeMillis(30000);
    p.setMinIdle(10);
    p.setLogAbandoned(true);
    p.setRemoveAbandoned(true);
    p.setFairQueue(true);
    p.setJdbcInterceptors(
            "org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;" +
                    "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
    dataSource = new DataSource();
    dataSource.setPoolProperties(p);
}
 
开发者ID:edgar615,项目名称:javase-study,代码行数:30,代码来源:Sql2oTest.java

示例15: DBConnection

import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
public DBConnection(JdbcConfiguration configuration) {
	PoolProperties p = new PoolProperties();
	p.setDriverClassName(configuration.getDriverClass());
	p.setUrl(configuration.getUrl());
	p.setUsername(configuration.getUsername());
	p.setPassword(configuration.getPassword());
	p.setJmxEnabled(true);
	p.setTestWhileIdle(false);
	p.setTestOnBorrow(true);
	p.setValidationQuery("SELECT 1");
	p.setTestOnReturn(false);
	p.setValidationInterval(30000);
	p.setTimeBetweenEvictionRunsMillis(30000);
	p.setMaxActive(100);
	p.setInitialSize(10);
	p.setMaxWait(10000);
	p.setRemoveAbandonedTimeout(60);
	p.setMinEvictableIdleTimeMillis(30000);
	p.setMinIdle(10);
	p.setLogAbandoned(true);
	p.setRemoveAbandoned(true);
	p.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"
							+ "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
	
	this.dataSource = new DataSource();
	this.dataSource.setPoolProperties(p);
	
}
 
开发者ID:fengsage,项目名称:jfinal-admin-gen,代码行数:29,代码来源:DBConnection.java


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