diff --git a/src/de/diddiz/LogBlock/Logging.java b/src/de/diddiz/LogBlock/Logging.java index f02d47e..9879c2b 100644 --- a/src/de/diddiz/LogBlock/Logging.java +++ b/src/de/diddiz/LogBlock/Logging.java @@ -3,7 +3,7 @@ package de.diddiz.LogBlock; 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; - public static int length = Logging.values().length; + public static final int length = Logging.values().length; private final boolean defaultEnabled; diff --git a/src/de/diddiz/util/MySQLConnectionPool.java b/src/de/diddiz/util/MySQLConnectionPool.java index 962b057..e0264f2 100644 --- a/src/de/diddiz/util/MySQLConnectionPool.java +++ b/src/de/diddiz/util/MySQLConnectionPool.java @@ -18,6 +18,7 @@ import java.sql.Savepoint; import java.sql.Statement; import java.sql.Struct; import java.util.Enumeration; +import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.Vector; @@ -85,9 +86,12 @@ public class MySQLConnectionPool implements Closeable private void reapConnections() { lock.lock(); final long stale = System.currentTimeMillis() - timeToLive; - for (final JDCConnection conn : connections) + final Iterator itr = connections.iterator(); + while (itr.hasNext()) { + final JDCConnection conn = itr.next(); if (conn.inUse() && stale > conn.getLastUse() && !conn.isValid()) - connections.remove(conn); + itr.remove(); + } lock.unlock(); }