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; 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 {

View File

@@ -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