forked from LogBlock/LogBlock
Fixed writelock issue.
This commit is contained in:
@@ -53,8 +53,10 @@ public class LBPlayerListener extends PlayerListener
|
|||||||
return;
|
return;
|
||||||
Statement state = null;
|
Statement state = null;
|
||||||
try {
|
try {
|
||||||
|
conn.setAutoCommit(false);
|
||||||
state = conn.createStatement();
|
state = conn.createStatement();
|
||||||
state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + event.getPlayer().getName() + "');");
|
state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + event.getPlayer().getName() + "');");
|
||||||
|
conn.commit();
|
||||||
} catch (final SQLException ex) {
|
} catch (final SQLException ex) {
|
||||||
log.log(Level.SEVERE, "[LogBlock] SQL exception", ex);
|
log.log(Level.SEVERE, "[LogBlock] SQL exception", ex);
|
||||||
} finally {
|
} finally {
|
||||||
|
@@ -136,6 +136,13 @@ public class ConnectionPool {
|
|||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
inuse = false;
|
inuse = false;
|
||||||
|
try {
|
||||||
|
if (!conn.getAutoCommit())
|
||||||
|
conn.setAutoCommit(true);
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
removeConnection(this);
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user