This commit is contained in:
Gabriele C 2015-08-22 16:34:06 +02:00
parent c12e24d0f8
commit 217c217d13
3 changed files with 17 additions and 7 deletions

View File

@ -180,7 +180,7 @@
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<scope>compile</scope>
<exclusions>
<exclusion>

View File

@ -505,9 +505,11 @@ public class FileCache {
else armours[i] = item;
}
} catch (final RuntimeException e) {
//verbose
e.printStackTrace();
ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming...");
} catch (final Exception e) {
//verbose
e.printStackTrace();
ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming...");
} finally {
@ -517,10 +519,12 @@ public class FileCache {
return new DataFileCache(inv, armours, group, op, flying);
}
} catch (RuntimeException e) {
// Verbose
e.printStackTrace();
ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming...");
return null;
} catch (Exception e) {
// Verbose
e.printStackTrace();
ConsoleLogger.showError("Error while reading file for " + player.getName() + ", some wipe inventory incoming...");
return null;

View File

@ -113,16 +113,19 @@ public class MySQL implements DataSource {
throws ClassNotFoundException, SQLException, TimeoutException,
NumberFormatException, PoolInitializationException {
HikariConfig config = new HikariConfig();
config.setPoolName("AuthMeMYSQLPool");
config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database);
config.setUsername(this.username);
config.setPassword(this.password);
config.setPoolName("AuthMeMYSQLPool");
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
config.addDataSourceProperty("autoReconnect", true);
config.setMaxLifetime(12000);
config.setInitializationFailFast(false);
config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable
config.setMaxLifetime(12000); // 12 Sec
config.setIdleTimeout(120000); // 2 Min
config.setMaximumPoolSize(50); // 50 Connections (including idle connections)
ds = new HikariDataSource(config);
ConsoleLogger.info("Connection pool ready");
}
@ -907,6 +910,8 @@ public class MySQL implements DataSource {
if (ds != null)
ds.close();
HikariConfig config = new HikariConfig();
config.setPoolName("AuthMeMYSQLPool");
config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
config.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database);
config.setUsername(this.username);
config.setPassword(this.password);
@ -914,9 +919,10 @@ public class MySQL implements DataSource {
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
config.addDataSourceProperty("autoReconnect", true);
config.setInitializationFailFast(false);
config.setMaxLifetime(12000);
config.setPoolName("AuthMeMYSQLPool");
config.setInitializationFailFast(true); // Don't start the plugin if the database is unavariable
config.setMaxLifetime(12000); // 12 Sec
config.setIdleTimeout(120000); // 2 Min
config.setMaximumPoolSize(50); // 50 Connections (including idle connections)
ds = new HikariDataSource(config);
if (!reload)
ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!");