diff --git a/core/java/src/net/i2p/util/Executor.java b/core/java/src/net/i2p/util/Executor.java index 8092d7ac44..3c81d46f15 100644 --- a/core/java/src/net/i2p/util/Executor.java +++ b/core/java/src/net/i2p/util/Executor.java @@ -5,10 +5,10 @@ import java.util.List; import net.i2p.I2PAppContext; class Executor implements Runnable { - private I2PAppContext _context; + private final I2PAppContext _context; private Log _log; private final List _readyEvents; - private SimpleStore runn; + private final SimpleStore runn; public Executor(I2PAppContext ctx, Log log, List events, SimpleStore x) { _context = ctx; @@ -31,9 +31,10 @@ class Executor implements Runnable { try { evt.timeReached(); } catch (Throwable t) { - log("wtf, event borked: " + evt, t); + log("Executing task " + evt + " exited unexpectedly, please report", t); } long time = _context.clock().now() - before; + // FIXME _log won't be non-null unless we already had a CRIT if ( (time > 1000) && (_log != null) && (_log.shouldLog(Log.WARN)) ) _log.warn("wtf, event execution took " + time + ": " + evt); } diff --git a/core/java/src/net/i2p/util/SimpleScheduler.java b/core/java/src/net/i2p/util/SimpleScheduler.java index f764debe99..951f5929eb 100644 --- a/core/java/src/net/i2p/util/SimpleScheduler.java +++ b/core/java/src/net/i2p/util/SimpleScheduler.java @@ -30,10 +30,10 @@ public class SimpleScheduler { public static SimpleScheduler getInstance() { return _instance; } private static final int MIN_THREADS = 2; private static final int MAX_THREADS = 4; - private I2PAppContext _context; - private Log _log; - private ScheduledThreadPoolExecutor _executor; - private String _name; + private final I2PAppContext _context; + private final Log _log; + private final ScheduledThreadPoolExecutor _executor; + private final String _name; private int _count; private final int _threads; @@ -42,7 +42,6 @@ public class SimpleScheduler { _context = I2PAppContext.getGlobalContext(); _log = _context.logManager().getLog(SimpleScheduler.class); _name = name; - _count = 0; long maxMemory = Runtime.getRuntime().maxMemory(); _threads = (int) Math.max(MIN_THREADS, Math.min(MAX_THREADS, 1 + (maxMemory / (32*1024*1024)))); _executor = new ScheduledThreadPoolExecutor(_threads, new CustomThreadFactory()); @@ -139,7 +138,7 @@ public class SimpleScheduler { try { _timedEvent.timeReached(); } catch (Throwable t) { - _log.log(Log.CRIT, _name + " wtf, event borked: " + _timedEvent, t); + _log.log(Log.CRIT, _name + ": Scheduled task " + _timedEvent + " exited unexpectedly, please report", t); } long time = System.currentTimeMillis() - before; if (time > 1000 && _log.shouldLog(Log.WARN)) diff --git a/core/java/src/net/i2p/util/SimpleTimer.java b/core/java/src/net/i2p/util/SimpleTimer.java index f428afceb9..ee3f35120f 100644 --- a/core/java/src/net/i2p/util/SimpleTimer.java +++ b/core/java/src/net/i2p/util/SimpleTimer.java @@ -14,6 +14,8 @@ import net.i2p.I2PAppContext; * appropriate time. The method that is fired however should NOT block (otherwise * they b0rk the timer). * + * WARNING - Deprecated. + * This is an inefficient mess. Use SimpleScheduler or SimpleTimer2 if possible. */ public class SimpleTimer { private static final SimpleTimer _instance = new SimpleTimer(); diff --git a/core/java/src/net/i2p/util/SimpleTimer2.java b/core/java/src/net/i2p/util/SimpleTimer2.java index 44e405b248..a497915e23 100644 --- a/core/java/src/net/i2p/util/SimpleTimer2.java +++ b/core/java/src/net/i2p/util/SimpleTimer2.java @@ -29,10 +29,10 @@ public class SimpleTimer2 { public static SimpleTimer2 getInstance() { return _instance; } private static final int MIN_THREADS = 2; private static final int MAX_THREADS = 4; - private I2PAppContext _context; + private final I2PAppContext _context; private static Log _log; // static so TimedEvent can use it - private ScheduledThreadPoolExecutor _executor; - private String _name; + private final ScheduledThreadPoolExecutor _executor; + private final String _name; private int _count; private final int _threads; @@ -223,7 +223,7 @@ public class SimpleTimer2 { try { timeReached(); } catch (Throwable t) { - _log.log(Log.CRIT, _pool + " wtf, event borked: " + this, t); + _log.log(Log.CRIT, _pool + ": Timed task " + this + " exited unexpectedly, please report", t); } long time = System.currentTimeMillis() - before; if (time > 500 && _log.shouldLog(Log.WARN)) diff --git a/history.txt b/history.txt index 967b5b7632..4aa6626fac 100644 --- a/history.txt +++ b/history.txt @@ -1,9 +1,15 @@ +2011-02-15 zzz + * i2psnark: Details link shuffle, mostly restore 0.8.3 behavior + * Profiles: Punish rejections more, in an attempt to spread the + load more through the network + * Timers: Log cleanup + 2011-02-14 Mathiasdm * Fix headless issue without reboot 2011-02-13 zzz * Connect Client: Minor NPE fix cleanup - * JobQueue: Prevet NPE at shutdown (thanks liberty) + * JobQueue: Prevent NPE at shutdown (thanks liberty) * GeoIP: Prevent startup NPE (ticket #413, thanks RN) * NetDB: Prevent ExpireLeaseJob NPE (thanks sponge) @@ -21,6 +27,7 @@ * I2CP: Correctly close internal connections on the router side when closed by the client, was causing massive memory leak for internal clients using lots of sessions (thanks sponge) + (ticket #397) * i2psnark: - Improved magnet link parsing, use tr parameter if present * i2ptunnel: Change shared clients default for new clients to false diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 5a58b19bc2..e36cd3b143 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 11; + public final static long BUILD = 12; /** for example "-test" */ public final static String EXTRA = "";