當前位置: 首頁>>代碼示例>>Java>>正文


Java PoolProperties.setNumTestsPerEvictionRun方法代碼示例

本文整理匯總了Java中org.apache.tomcat.jdbc.pool.PoolProperties.setNumTestsPerEvictionRun方法的典型用法代碼示例。如果您正苦於以下問題:Java PoolProperties.setNumTestsPerEvictionRun方法的具體用法?Java PoolProperties.setNumTestsPerEvictionRun怎麽用?Java PoolProperties.setNumTestsPerEvictionRun使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tomcat.jdbc.pool.PoolProperties的用法示例。


在下文中一共展示了PoolProperties.setNumTestsPerEvictionRun方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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);
	}
}
 
開發者ID:Bonsanto,項目名稱:db-component,代碼行數:73,代碼來源:DBConnection.java


注:本文中的org.apache.tomcat.jdbc.pool.PoolProperties.setNumTestsPerEvictionRun方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。