Java Code Examples for com.atomikos.jdbc.AtomikosDataSourceBean#setMaxIdleTime()

The following examples show how to use com.atomikos.jdbc.AtomikosDataSourceBean#setMaxIdleTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataSourceConfig.java    From mybatis.flying with Apache License 2.0 5 votes vote down vote up
@Bean("dataSource1")
@Primary
public AtomikosDataSourceBean dataSource1() {
	AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
	ds.setXaDataSource(xaDataSource1());
	ds.setUniqueResourceName("testdb");
	ds.setMinPoolSize(1);
	ds.setMaxPoolSize(3);
	ds.setMaxIdleTime(60);
	return ds;
}
 
Example 2
Source File: DataSourceConfig.java    From mybatis.flying with Apache License 2.0 5 votes vote down vote up
@Bean("dataSource2")
public DataSource dataSource2() {
	AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
	ds.setXaDataSource(xaDataSource2());
	ds.setUniqueResourceName("testdb2");
	ds.setMinPoolSize(1);
	ds.setMaxPoolSize(3);
	ds.setMaxIdleTime(60);
	return ds;
}
 
Example 3
Source File: AtomikosDataSourceConfig.java    From hsweb-framework with Apache License 2.0 5 votes vote down vote up
@SneakyThrows
public void putProperties(AtomikosDataSourceBean atomikosDataSourceBean) {

    if (null != xaProperties) {
        xaProperties.entrySet().forEach(entry -> entry.setValue(String.valueOf(entry.getValue())));
    }
    //fix #87
    XADataSource dataSource = (XADataSource) Class.forName(getXaDataSourceClassName()).newInstance();
    FastBeanCopier.copy(xaProperties, dataSource);
    atomikosDataSourceBean.setXaDataSource(dataSource);

    atomikosDataSourceBean.setXaDataSourceClassName(getXaDataSourceClassName());
    atomikosDataSourceBean.setBorrowConnectionTimeout(getBorrowConnectionTimeout());
    if (loginTimeout != 0) {
        try {
            atomikosDataSourceBean.setLoginTimeout(getLoginTimeout());
        } catch (SQLException e) {
            log.warn(e.getMessage(), e);
        }
    }
    atomikosDataSourceBean.setMaxIdleTime(getMaxIdleTime());
    atomikosDataSourceBean.setMaxPoolSize(getMaxPoolSize());
    atomikosDataSourceBean.setMinPoolSize(getMinPoolSize());
    atomikosDataSourceBean.setDefaultIsolationLevel(getDefaultIsolationLevel());
    atomikosDataSourceBean.setMaintenanceInterval(getMaintenanceInterval());
    atomikosDataSourceBean.setReapTimeout(getReapTimeout());
    atomikosDataSourceBean.setTestQuery(getTestQuery());
    atomikosDataSourceBean.setXaProperties(getXaProperties());
    atomikosDataSourceBean.setMaxLifetime(getMaxLifetime());
}