forked from LogBlock/LogBlock
Merge branch 'master' into HEAD
This commit is contained in:
@@ -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 {
|
||||
|
@@ -16,6 +16,7 @@ import java.sql.SQLXML;
|
||||
import java.sql.Savepoint;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Struct;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
@@ -45,8 +46,8 @@ public class ConnectionPool {
|
||||
if (conn.isValid())
|
||||
return conn;
|
||||
else {
|
||||
conn.terminate();
|
||||
connections.remove(conn);
|
||||
conn.terminate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,12 +66,14 @@ public class ConnectionPool {
|
||||
for (final JDCConnection conn : connections)
|
||||
if (conn.inUse() && stale > conn.getLastUse() && !conn.isValid())
|
||||
connections.remove(conn);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void closeConnections() {
|
||||
for (final JDCConnection conn : connections) {
|
||||
conn.terminate();
|
||||
final Enumeration<JDCConnection> conns = connections.elements();
|
||||
while (conns.hasMoreElements()) {
|
||||
final JDCConnection conn = conns.nextElement();
|
||||
connections.remove(conn);
|
||||
conn.terminate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +129,13 @@ public class ConnectionPool {
|
||||
@Override
|
||||
public void close() {
|
||||
inuse = false;
|
||||
try {
|
||||
if (!conn.getAutoCommit())
|
||||
conn.setAutoCommit(true);
|
||||
} catch (SQLException ex) {
|
||||
connections.remove(conn);
|
||||
terminate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,5 +1,5 @@
|
||||
name: LogBlock
|
||||
version: 0.15
|
||||
version: 0.15b
|
||||
author: DiddiZ, bootswithdefer
|
||||
website: http://www.diddiz.de/minecraft/
|
||||
main: de.diddiz.LogBlock.LogBlock
|
||||
|
Reference in New Issue
Block a user