Configurable :P

This commit is contained in:
t00thpick1 2014-07-28 16:46:55 -04:00
parent ed82a838c8
commit 9a12d86eac
3 changed files with 10 additions and 2 deletions

View File

@ -313,6 +313,8 @@ public class Config extends AutoUpdateConfigLoader {
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); } public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); } public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
public String getMySQLUserPassword() { return getStringIncludingInts("MySQL.Database.User_Password"); } public String getMySQLUserPassword() { return getStringIncludingInts("MySQL.Database.User_Password"); }
public int getMySQLMaxConnections() { return config.getInt("MySQL.Database.MaxConnections"); }
public int getMySQLMaxPoolSize() { return config.getInt("MySQL.Database.MaxPoolSize"); }
private String getStringIncludingInts(String key) { private String getStringIncludingInts(String key) {
String str = config.getString(key); String str = config.getString(key);

View File

@ -52,8 +52,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
connectionProperties.put("autoReconnect", "false"); connectionProperties.put("autoReconnect", "false");
connectionPool = new ConnectionPool("mcMMO-Pool", connectionPool = new ConnectionPool("mcMMO-Pool",
1 /*Minimum of one*/, 1 /*Minimum of one*/,
10 /*max pool size */, // TODO Configurable? Config.getInstance().getMySQLMaxPoolSize() /*max pool size */,
10 /*max num connections*/, // TODO Configurable? Config.getInstance().getMySQLMaxConnections() /*max num connections*/,
0 /* idle timeout of connections */, 0 /* idle timeout of connections */,
connectionString, connectionString,
connectionProperties); connectionProperties);

View File

@ -122,6 +122,12 @@ MySQL:
User_Password: UserPassword User_Password: UserPassword
Name: DataBaseName Name: DataBaseName
TablePrefix: mcmmo_ TablePrefix: mcmmo_
# This setting is the max simultaneous mysql connections allowed at a time, needs to be
# high enough to support multiple player logins in quick succession
MaxConnections: 30
# This setting is the max size of the pool of cached connections that we hold available
# at any given time
MaxPoolSize: 20
Server: Server:
Port: 3306 Port: 3306
Address: localhost Address: localhost