mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-20 23:57:34 +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 {
|
private synchronized void setConnectionArguments() throws RuntimeException {
|
||||||
ds = new HikariDataSource();
|
ds = new HikariDataSource();
|
||||||
ds.setPoolName("AuthMeMYSQLPool");
|
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("characterEncoding", "utf8");
|
||||||
ds.addDataSourceProperty("encoding","UTF-8");
|
ds.addDataSourceProperty("encoding","UTF-8");
|
||||||
ds.addDataSourceProperty("useUnicode", "true");
|
ds.addDataSourceProperty("useUnicode", "true");
|
||||||
|
|
||||||
ds.setUsername(this.username);
|
// Random stuff
|
||||||
ds.setPassword(this.password);
|
ds.addDataSourceProperty("rewriteBatchedStatements", "true");
|
||||||
ds.setInitializationFailFast(true); // Don't start the plugin if the database is unavailable
|
ds.addDataSourceProperty("jdbcCompliantTruncation", "false");
|
||||||
ds.setMaxLifetime(180000); // 3 Min
|
|
||||||
ds.setIdleTimeout(60000); // 1 Min
|
// Caching
|
||||||
ds.setMinimumIdle(2);
|
ds.addDataSourceProperty("cachePrepStmts", "true");
|
||||||
ds.setMaximumPoolSize((Runtime.getRuntime().availableProcessors() * 2) + 1);
|
ds.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||||
|
ds.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||||
|
|
||||||
ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
|
ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (shouldCancelEvent(player)) {
|
if (shouldCancelEvent(player)) {
|
||||||
event.setCancelled(true);
|
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.
|
// Possible solution: add a cooldown.
|
||||||
// sendLoginOrRegisterMessage(player);
|
// sendLoginOrRegisterMessage(player);
|
||||||
} else if (settings.getProperty(RestrictionSettings.HIDE_CHAT)) {
|
} else if (settings.getProperty(RestrictionSettings.HIDE_CHAT)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user