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;
protected volatile DataSource dataSource;
protected DataSource dataSource;
@Inject
public MySQLDB(
@ -114,7 +114,7 @@ public class MySQLDB extends SQLDB {
}
@Override
public Connection getConnection() throws SQLException {
public synchronized Connection getConnection() throws SQLException {
Connection connection = dataSource.getConnection();
if (!connection.isValid(5)) {
connection.close();

View File

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