mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2025-01-17 20:51:33 +01:00
Make MySQL maximumPoolSize configurable (#411)
* Make MySQL maximumPoolSize configurable * Correctly assign default value to mysql-maximum-pool-size --------- Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
This commit is contained in:
parent
342fadd0f6
commit
6045799fea
@ -88,6 +88,7 @@ public class Config extends Language {
|
||||
public boolean PLAYER_SESSIONS;
|
||||
public boolean USERNAME_CHANGES;
|
||||
public boolean WORLDEDIT;
|
||||
public int MYSQL_MAXIMUM_POOL_SIZE;
|
||||
public int MYSQL_PORT;
|
||||
public int DEFAULT_RADIUS;
|
||||
public int MAX_RADIUS;
|
||||
@ -203,6 +204,7 @@ public class Config extends Language {
|
||||
this.MYSQL_DATABASE = this.getString("mysql-database");
|
||||
this.MYSQL_USERNAME = this.getString("mysql-username");
|
||||
this.MYSQL_PASSWORD = this.getString("mysql-password");
|
||||
this.MYSQL_MAXIMUM_POOL_SIZE = this.getInt("mysql-maximum-pool-size", 10);
|
||||
this.LANGUAGE = this.getString("language");
|
||||
this.CHECK_UPDATES = this.getBoolean("check-updates");
|
||||
this.API_ENABLED = this.getBoolean("api-enabled");
|
||||
|
@ -52,6 +52,8 @@ public class ConfigHandler extends Queue {
|
||||
public static String username = "root";
|
||||
public static String password = "";
|
||||
public static String prefix = "co_";
|
||||
public static int maximumPoolSize = 10;
|
||||
|
||||
public static HikariDataSource hikariDataSource = null;
|
||||
public static final boolean isSpigot = Util.isSpigot();
|
||||
public static final boolean isPaper = Util.isPaper();
|
||||
@ -174,6 +176,7 @@ public class ConfigHandler extends Queue {
|
||||
ConfigHandler.database = Config.getGlobal().MYSQL_DATABASE;
|
||||
ConfigHandler.username = Config.getGlobal().MYSQL_USERNAME;
|
||||
ConfigHandler.password = Config.getGlobal().MYSQL_PASSWORD;
|
||||
ConfigHandler.maximumPoolSize = Config.getGlobal().MYSQL_MAXIMUM_POOL_SIZE;
|
||||
ConfigHandler.prefix = Config.getGlobal().PREFIX;
|
||||
|
||||
ConfigHandler.loadBlacklist(); // Load the blacklist file if it exists.
|
||||
@ -230,6 +233,7 @@ public class ConfigHandler extends Queue {
|
||||
config.setJdbcUrl("jdbc:mysql://" + ConfigHandler.host + ":" + ConfigHandler.port + "/" + ConfigHandler.database);
|
||||
config.setUsername(ConfigHandler.username);
|
||||
config.setPassword(ConfigHandler.password);
|
||||
config.setMaximumPoolSize(ConfigHandler.maximumPoolSize);
|
||||
config.setMaxLifetime(60000);
|
||||
config.addDataSourceProperty("characterEncoding", "UTF-8");
|
||||
config.addDataSourceProperty("connectionTimeout", "10000");
|
||||
|
Loading…
Reference in New Issue
Block a user