本文整理汇总了Java中org.apache.tomcat.jdbc.pool.PoolProperties.setFairQueue方法的典型用法代码示例。如果您正苦于以下问题:Java PoolProperties.setFairQueue方法的具体用法?Java PoolProperties.setFairQueue怎么用?Java PoolProperties.setFairQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tomcat.jdbc.pool.PoolProperties
的用法示例。
在下文中一共展示了PoolProperties.setFairQueue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: setAllPoolProperties
import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
public void setAllPoolProperties() throws Exception {
poolProperties = new PoolProperties();
//todo: probably more ifs to provide more information of which wasn't defined.
if (url == null || driverClassName == null || userName == null || password == null) {
throw new Exception("A mandatory item wasn't defined correctly");
} else {
//Mandatory items.
poolProperties.setUrl(url);
poolProperties.setDriverClassName(driverClassName);
poolProperties.setUsername(userName);
poolProperties.setPassword(password);
//Not Mandatory Items.
if (abandonWhenPercentageFull != null)
poolProperties.setAbandonWhenPercentageFull(abandonWhenPercentageFull);
if (accessToUnderlyingConnectionAllowed != null)
poolProperties.setAccessToUnderlyingConnectionAllowed(accessToUnderlyingConnectionAllowed);
if (alternateUsernameAllowed != null) poolProperties.setAlternateUsernameAllowed(alternateUsernameAllowed);
if (commitOnReturn != null) poolProperties.setCommitOnReturn(commitOnReturn);
if (connectionProperties != null) poolProperties.setConnectionProperties(connectionProperties);
if (dataSource != null) poolProperties.setDataSource(dataSource); //todo: probably a problem.
if (dataSourceJNDI != null) poolProperties.setDataSourceJNDI(dataSourceJNDI);
if (dbProperties != null) poolProperties.setDbProperties(dbProperties);
if (defaultAutoCommit != null) poolProperties.setDefaultAutoCommit(defaultAutoCommit);
if (defaultCatalog != null) poolProperties.setDefaultCatalog(defaultCatalog);
if (defaultReadOnly != null) poolProperties.setDefaultReadOnly(defaultReadOnly);
if (defaultTranslationIsolation != null)
poolProperties.setDefaultTransactionIsolation(defaultTranslationIsolation);
if (fairQueue != null) poolProperties.setFairQueue(fairQueue);
if (ignoreExceptionOnPreLoad != null) poolProperties.setIgnoreExceptionOnPreLoad(ignoreExceptionOnPreLoad);
if (initialSize != null) poolProperties.setInitialSize(initialSize);
if (initSQL != null) poolProperties.setInitSQL(initSQL);
if (jdbcInterceptors != null) poolProperties.setJdbcInterceptors(jdbcInterceptors);
if (jmxEnabled != null) poolProperties.setJmxEnabled(jmxEnabled);
if (logAbandoned != null) poolProperties.setLogAbandoned(logAbandoned);
if (logValidationErrors != null) poolProperties.setLogValidationErrors(logValidationErrors);
if (maxActive != null) poolProperties.setMaxActive(maxActive);
if (maxAge != null) poolProperties.setMaxAge(maxAge);
if (maxIdle != null) poolProperties.setMaxIdle(maxIdle);
if (maxWait != null) poolProperties.setMaxWait(maxWait);
if (minEvictableIdleTimeMillis != null)
poolProperties.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
if (minIdle != null) poolProperties.setMinIdle(minIdle);
if (name != null) poolProperties.setName(name);
if (numTestsPerEvictionRun != null) poolProperties.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
if (propagateInterruptState != null) poolProperties.setPropagateInterruptState(propagateInterruptState);
if (removeAbandoned != null) poolProperties.setRemoveAbandoned(removeAbandoned);
if (removeAbandonedTimeout != null) poolProperties.setRemoveAbandonedTimeout(removeAbandonedTimeout);
if (rollbackOnReturn != null) poolProperties.setRollbackOnReturn(rollbackOnReturn);
if (suspectTimeout != null) poolProperties.setSuspectTimeout(suspectTimeout);
if (testOnBorrow != null) poolProperties.setTestOnBorrow(testOnBorrow);
if (testOnConnect != null) poolProperties.setTestOnConnect(testOnConnect);
if (testOnReturn != null) poolProperties.setTestOnReturn(testOnReturn);
if (testWhileIdle != null) poolProperties.setTestWhileIdle(testWhileIdle);
if (timeBetweenEvictionsRunMillis != null)
poolProperties.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionsRunMillis);
if (useDisposableConnectionFacade != null)
poolProperties.setUseDisposableConnectionFacade(useDisposableConnectionFacade);
if (useEquals != null) poolProperties.setUseEquals(useEquals);
if (useLock != null) poolProperties.setUseLock(useLock);
if (validationInterval != null) poolProperties.setValidationInterval(validationInterval);
if (validationQuery != null) poolProperties.setValidationQuery(validationQuery);
if (validationQueryTimeout != null) poolProperties.setValidationQueryTimeout(validationQueryTimeout);
if (validator != null) poolProperties.setValidator(validator);
if (validatorClassName != null) poolProperties.setValidatorClassName(validatorClassName);
//Set the DataSource Provider's Properties.
dataSourceProvider = new DataSource();
dataSourceProvider.setPoolProperties(poolProperties);
}
}
示例6: connectToMYSQLConnectionPool
import org.apache.tomcat.jdbc.pool.PoolProperties; //导入方法依赖的package包/类
private void connectToMYSQLConnectionPool()throws SSErr{
try{
Class.forName("com.mysql.jdbc.Driver");
// private static BoneCP connectionPool = null;
// BoneCPConfig config = new BoneCPConfig();
// config.setJdbcUrl ("jdbc:mysql://" + ((SSDBSQLConf)conf).host + SSStrU.colon + ((SSDBSQLConf)conf).port + SSStrU.slash + ((SSDBSQLConf)conf).schema); // jdbc url specific to your database, eg jdbc:mysql://127.0.0.1/yourdb
// config.setUsername (((SSDBSQLConf)conf).username);
// config.setPassword (((SSDBSQLConf)conf).password);
// config.setMinConnectionsPerPartition(5);
// config.setMaxConnectionsPerPartition(10);
// config.setPartitionCount(4);
// config.setLogStatementsEnabled(true);
// config.setPoolStrategy("DEFAULT");
// config.setAcquireRetryAttempts(1);
// config.setAcquireRetryDelayInMs(1100);
// config.setConnectionTimeoutInMs(1300);
//
// config.setTransactionRecoveryEnabled(false);
//
// connectionPool = new BoneCP(config);
PoolProperties prop = new PoolProperties();
prop.setUrl ("jdbc:mysql://" + ((SSDBSQLConf)conf).host + SSStrU.colon + ((SSDBSQLConf)conf).port + SSStrU.slash + ((SSDBSQLConf)conf).schema + "?autoReconnect=true");
prop.setDriverClassName ("com.mysql.jdbc.Driver");
prop.setUsername (((SSDBSQLConf)conf).username);
prop.setPassword (((SSDBSQLConf)conf).password);
prop.setFairQueue(true);
prop.setTestWhileIdle(true);
prop.setValidationInterval(30000);
prop.setMaxActive(100);
prop.setInitialSize(10);
prop.setMinIdle(10);
prop.setMaxWait(10000);
prop.setRemoveAbandoned(false);
prop.setMinEvictableIdleTimeMillis(30000);
prop.setTestOnBorrow(true);
prop.setValidationQuery("select 1");
connectionPool = new DataSource(prop);
}catch(Exception error){
SSServErrReg.regErrThrow(SSErrE.mySQLConnectionFailed, error);
}
}