Fixed writelock issue.

This commit is contained in:
Robin Kupper
2011-05-06 00:10:06 +02:00
parent 7d0ef7b264
commit 2012454b75
2 changed files with 9 additions and 0 deletions

View File

@@ -53,8 +53,10 @@ public class LBPlayerListener extends PlayerListener
return;
Statement state = null;
try {
conn.setAutoCommit(false);
state = conn.createStatement();
state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + event.getPlayer().getName() + "');");
conn.commit();
} catch (final SQLException ex) {
log.log(Level.SEVERE, "[LogBlock] SQL exception", ex);
} finally {

View File

@@ -136,6 +136,13 @@ public class ConnectionPool {
@Override
public void close() {
inuse = false;
try {
if (!conn.getAutoCommit())
conn.setAutoCommit(true);
} catch (SQLException ex) {
removeConnection(this);
terminate();
}
}
@Override