* Watchdog: Don't dump threads too often (ticket #519)

This commit is contained in:
zzz
2012-10-21 17:21:49 +00:00
parent e329742c8d
commit 95870df45b
3 changed files with 12 additions and 3 deletions

View File

@ -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 = 17;
public final static long BUILD = 18;
/** for example "-test" */
public final static String EXTRA = "-rc";

View File

@ -23,8 +23,10 @@ public class RouterWatchdog implements Runnable {
private final RouterContext _context;
private int _consecutiveErrors;
private volatile boolean _isRunning;
private long _lastDump;
private static final long MAX_JOB_RUN_LAG = 60*1000;
private static final long MIN_DUMP_INTERVAL= 6*60*60*1000;
public RouterWatchdog(RouterContext ctx) {
_context = ctx;
@ -69,7 +71,7 @@ public class RouterWatchdog implements Runnable {
// Client manager starts complaining after 10 minutes, and we run every minute,
// so this will restart 30 minutes after we lose a lease, if the wrapper is present.
if (_consecutiveErrors >= 20 && System.getProperty("wrapper.version") != null)
if (_consecutiveErrors >= 20 && SystemVersion.hasWrapper())
return true;
return false;
}
@ -113,7 +115,11 @@ public class RouterWatchdog implements Runnable {
// This works on linux...
// It won't on windows, and we can't call i2prouter.bat either, it does something
// completely different...
ThreadDump.dump(_context, 10);
long now = _context.clock().now();
if (now - _lastDump > MIN_DUMP_INTERVAL) {
_lastDump = now;
ThreadDump.dump(_context, 10);
}
}
}
}