forked from LogBlock/LogBlock
Fixed ConcurrentModificationException
This commit is contained in:
@@ -3,7 +3,7 @@ package de.diddiz.LogBlock;
|
|||||||
public enum Logging {
|
public enum Logging {
|
||||||
BLOCKPLACE(true), BLOCKBREAK(true), SIGNTEXT, TNTEXPLOSION(true), CREEPEREXPLOSION(true), GHASTFIREBALLEXPLOSION(true), ENDERDRAGON(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY, LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT, SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, NATURALSTRUCTUREGROW, BONEMEALSTRUCTUREGROW;
|
BLOCKPLACE(true), BLOCKBREAK(true), SIGNTEXT, TNTEXPLOSION(true), CREEPEREXPLOSION(true), GHASTFIREBALLEXPLOSION(true), ENDERDRAGON(true), MISCEXPLOSION, FIRE(true), LEAVESDECAY, LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT, SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, NATURALSTRUCTUREGROW, BONEMEALSTRUCTUREGROW;
|
||||||
|
|
||||||
public static int length = Logging.values().length;
|
public static final int length = Logging.values().length;
|
||||||
|
|
||||||
private final boolean defaultEnabled;
|
private final boolean defaultEnabled;
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ import java.sql.Savepoint;
|
|||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.sql.Struct;
|
import java.sql.Struct;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
@@ -85,9 +86,12 @@ public class MySQLConnectionPool implements Closeable
|
|||||||
private void reapConnections() {
|
private void reapConnections() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
final long stale = System.currentTimeMillis() - timeToLive;
|
final long stale = System.currentTimeMillis() - timeToLive;
|
||||||
for (final JDCConnection conn : connections)
|
final Iterator<JDCConnection> itr = connections.iterator();
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
final JDCConnection conn = itr.next();
|
||||||
if (conn.inUse() && stale > conn.getLastUse() && !conn.isValid())
|
if (conn.inUse() && stale > conn.getLastUse() && !conn.isValid())
|
||||||
connections.remove(conn);
|
itr.remove();
|
||||||
|
}
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user