Skip to content
Snippets Groups Projects
Commit 6fb1d59d authored by tpylak's avatar tpylak
Browse files

allow to specify maxActive and maxIdle for external databases

SVN: 17249
parent 041ea01a
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,10 @@ public class SimpleDatabaseConfigurationContext implements DisposableBean
static final String PASSWORD_KEY = "database-password";
static final String MAX_IDLE_KEY = "database-max-idle";
static final String MAX_ACTIVE_KEY = "database-max-active";
private IDataSourceFactory dataSourceFactory = new BasicDataSourceFactory();
private DataSource dataSource;
......@@ -69,6 +73,18 @@ public class SimpleDatabaseConfigurationContext implements DisposableBean
PropertyUtils.getProperty(properties, USER_KEY, System.getProperty("user.name")
.toLowerCase());
this.password = PropertyUtils.getProperty(properties, PASSWORD_KEY);
int maxActive = PropertyUtils.getInt(properties, MAX_ACTIVE_KEY, -1);
if (maxActive != -1)
{
dataSourceFactory.setMaxActive(maxActive);
}
int maxIdle = PropertyUtils.getInt(properties, MAX_IDLE_KEY, -1);
if (maxIdle != -1)
{
dataSourceFactory.setMaxIdle(maxIdle);
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment