mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-17 16:15:20 +01:00
Removed volatile from MySQL dataSource
Made getConnection synchronized on MySQL
This commit is contained in:
parent
ffa04f1b9f
commit
40585d70b2
@ -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();
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user