Add option to override dbcp size

This commit is contained in:
Gabriele C 2016-10-22 00:46:28 +02:00
parent 627b9dd5c5
commit 1867617dbb
3 changed files with 12 additions and 1 deletions

View File

@ -40,6 +40,7 @@ public class MySQL implements DataSource {
private String password;
private String database;
private String tableName;
private int poolSize;
private List<String> columnOthers;
private Columns col;
private HashAlgorithm hashAlgorithm;
@ -98,6 +99,10 @@ public class MySQL implements DataSource {
this.phpBbPrefix = settings.getProperty(HooksSettings.PHPBB_TABLE_PREFIX);
this.phpBbGroup = settings.getProperty(HooksSettings.PHPBB_ACTIVATED_GROUP_ID);
this.wordpressPrefix = settings.getProperty(HooksSettings.WORDPRESS_TABLE_PREFIX);
this.poolSize = settings.getProperty(DatabaseSettings.MYSQL_POOL_SIZE);
if(poolSize == -1) {
poolSize = RuntimeUtils.getCoreCount();
}
}
private void setConnectionArguments() throws RuntimeException {
@ -105,7 +110,7 @@ public class MySQL implements DataSource {
ds.setPoolName("AuthMeMYSQLPool");
// Pool size
ds.setMaximumPoolSize(RuntimeUtils.getCoreCount());
ds.setMaximumPoolSize(poolSize);
// Database URL
ds.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database);

View File

@ -98,6 +98,10 @@ public class DatabaseSettings implements SettingsHolder {
public static final Property<String> MYSQL_COL_GROUP =
newProperty("ExternalBoardOptions.mySQLColumnGroup", "");
@Comment("Overrides the size of the DB Connection Pool, -1 = Auto")
public static final Property<Integer> MYSQL_POOL_SIZE =
newProperty("DataSource.poolSize", -1);
private DatabaseSettings() {
}

View File

@ -40,6 +40,8 @@ DataSource:
mySQLlastlocWorld: world
# Column for RealName
mySQLRealName: realname
# Overrides the size of the DB Connection Pool, -1 = Auto
poolSize: -1
settings:
sessions:
# Do you want to enable the session feature?