mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-30 12:02:02 +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;
|
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();
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user