Removed volatile from MySQL dataSource

Made getConnection synchronized on MySQL
This commit is contained in:
Rsl1122 2018-11-16 19:27:04 +02:00
parent ffa04f1b9f
commit 40585d70b2
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ public class MySQLDB extends SQLDB {
private static int increment = 1; private static int increment = 1;
protected volatile DataSource dataSource; protected DataSource dataSource;
@Inject @Inject
public MySQLDB( public MySQLDB(
@ -114,7 +114,7 @@ public class MySQLDB extends SQLDB {
} }
@Override @Override
public Connection getConnection() throws SQLException { public synchronized Connection getConnection() throws SQLException {
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
if (!connection.isValid(5)) { if (!connection.isValid(5)) {
connection.close(); connection.close();

View File

@ -85,7 +85,7 @@ public class SpongeMySQLDB extends MySQLDB {
} }
@Override @Override
public Connection getConnection() throws SQLException { public synchronized Connection getConnection() throws SQLException {
try { try {
return super.getConnection(); return super.getConnection();
} catch (SQLException e) { } catch (SQLException e) {