mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-20 15:47:38 +01:00
Use default Hikari pool parameters
This commit is contained in:
parent
4d06b63e64
commit
7ad39e2a5d
@ -109,26 +109,28 @@ public class MySQL implements DataSource {
|
||||
private synchronized void setConnectionArguments() throws RuntimeException {
|
||||
ds = new HikariDataSource();
|
||||
ds.setPoolName("AuthMeMYSQLPool");
|
||||
ds.setDriverClassName("com.mysql.jdbc.Driver");
|
||||
ds.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database);
|
||||
ds.addDataSourceProperty("rewriteBatchedStatements", "true");
|
||||
ds.addDataSourceProperty("jdbcCompliantTruncation", "false");
|
||||
ds.addDataSourceProperty("cachePrepStmts", "true");
|
||||
ds.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
ds.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
|
||||
//set utf-8 as default encoding
|
||||
// Database URL
|
||||
ds.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database);
|
||||
|
||||
// Auth
|
||||
ds.setUsername(this.username);
|
||||
ds.setPassword(this.password);
|
||||
|
||||
// Encoding
|
||||
ds.addDataSourceProperty("characterEncoding", "utf8");
|
||||
ds.addDataSourceProperty("encoding","UTF-8");
|
||||
ds.addDataSourceProperty("useUnicode", "true");
|
||||
|
||||
ds.setUsername(this.username);
|
||||
ds.setPassword(this.password);
|
||||
ds.setInitializationFailFast(true); // Don't start the plugin if the database is unavailable
|
||||
ds.setMaxLifetime(180000); // 3 Min
|
||||
ds.setIdleTimeout(60000); // 1 Min
|
||||
ds.setMinimumIdle(2);
|
||||
ds.setMaximumPoolSize((Runtime.getRuntime().availableProcessors() * 2) + 1);
|
||||
// Random stuff
|
||||
ds.addDataSourceProperty("rewriteBatchedStatements", "true");
|
||||
ds.addDataSourceProperty("jdbcCompliantTruncation", "false");
|
||||
|
||||
// Caching
|
||||
ds.addDataSourceProperty("cachePrepStmts", "true");
|
||||
ds.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
ds.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
|
||||
ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final Player player = event.getPlayer();
|
||||
if (shouldCancelEvent(player)) {
|
||||
event.setCancelled(true);
|
||||
// TODO: a spambot calls this too often, too may threads checking if auth is available.
|
||||
// TODO: a spambot calls this too often, too many threads checking if auth is available.
|
||||
// Possible solution: add a cooldown.
|
||||
// sendLoginOrRegisterMessage(player);
|
||||
} else if (settings.getProperty(RestrictionSettings.HIDE_CHAT)) {
|
||||
|
Loading…
Reference in New Issue
Block a user