Make the max pool size configurable

This commit is contained in:
Luck 2016-10-21 22:22:06 +01:00
parent 270a276b98
commit 5d955e77b6
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
6 changed files with 8 additions and 2 deletions

View File

@ -149,6 +149,7 @@ data:
database: minecraft
username: root
password: ''
pool-size: 10 # The size of the MySQL connection pool.
# Set to -1 to disable. If this is the only instance accessing the datastore, you can disable syncing.
# e.g. if you're using sqlite or flatfile, this can be set to -1 to save resources.

View File

@ -107,6 +107,7 @@ data:
database: minecraft
username: root
password: ''
pool-size: 10 # The size of the MySQL connection pool.
# Set to -1 to disable. If this is the only instance accessing the datastore, you can disable syncing.
# e.g. if you're using sqlite or flatfile, this can be set to -1 to save resources.

View File

@ -130,7 +130,8 @@ public abstract class AbstractConfiguration<T extends LuckPermsPlugin> implement
getString("data.address", null),
getString("data.database", null),
getString("data.username", null),
getString("data.password", null)
getString("data.password", null),
getInt("data.pool-size", 10)
);
storageMethod = getString("storage-method", defaultStorage);
splitStorage = getBoolean("split-storage.enabled", false);

View File

@ -33,5 +33,6 @@ public class DatastoreConfiguration implements me.lucko.luckperms.api.data.Datas
private final String database;
private final String username;
private final String password;
private int poolSize;
}

View File

@ -57,7 +57,8 @@ public class MySQLBacking extends SQLBacking {
final String username = configuration.getUsername();
final String password = configuration.getPassword();
config.setMaximumPoolSize(10);
config.setMaximumPoolSize(configuration.getPoolSize());
config.setPoolName("luckperms");
config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
config.addDataSourceProperty("serverName", address.split(":")[0]);

View File

@ -107,6 +107,7 @@ data {
database="minecraft"
username="root"
password=""
pool-size=10 # The size of the MySQL connection pool.
# Set to -1 to disable. If this is the only instance accessing the datastore, you can disable syncing.
# e.g. if you're using sqlite or flatfile, this can be set to -1 to save resources.