forked from I2P_Developers/i2p.i2p
* Watchdog: Don't dump threads too often (ticket #519)
This commit is contained in:
@ -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";
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user