diff --git a/router/java/src/net/i2p/router/tasks/OOMListener.java b/router/java/src/net/i2p/router/tasks/OOMListener.java index a5e4ea49e1eeb17d063e7eded6e27f1dff43ea5a..1662b9ffe8076b1c46773889fb7086184a475e06 100644 --- a/router/java/src/net/i2p/router/tasks/OOMListener.java +++ b/router/java/src/net/i2p/router/tasks/OOMListener.java @@ -4,6 +4,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import net.i2p.router.Router; import net.i2p.router.RouterContext; +import net.i2p.router.util.EventLog; import net.i2p.util.I2PThread; import net.i2p.util.Log; @@ -34,6 +35,7 @@ public class OOMListener implements I2PThread.OOMEventListener { try { // boost priority to help us shut down + // this may or may not do anything... Thread.currentThread().setPriority(Thread.MAX_PRIORITY - 1); } catch (OutOfMemoryError oome) {} try { @@ -51,6 +53,9 @@ public class OOMListener implements I2PThread.OOMEventListener { try { ThreadDump.dump(_context, 1); } catch (OutOfMemoryError oome) {} + try { + _context.router().eventLog().addEvent(EventLog.OOM); + } catch (OutOfMemoryError oome) {} _context.router().shutdown(Router.EXIT_OOM); } } diff --git a/router/java/src/net/i2p/router/tasks/Restarter.java b/router/java/src/net/i2p/router/tasks/Restarter.java index 2d497abb4b4a7fbc54735d7197d77fef79141ad2..c904cad507f6e4f9ac6c92fe1ee4af65a155ff27 100644 --- a/router/java/src/net/i2p/router/tasks/Restarter.java +++ b/router/java/src/net/i2p/router/tasks/Restarter.java @@ -3,6 +3,7 @@ package net.i2p.router.tasks; import net.i2p.router.Router; import net.i2p.router.RouterClock; import net.i2p.router.RouterContext; +import net.i2p.router.util.EventLog; import net.i2p.util.Log; /** @@ -16,6 +17,7 @@ public class Restarter implements Runnable { } public void run() { + _context.router().eventLog().addEvent(EventLog.SOFT_RESTART); Log log = _context.logManager().getLog(Router.class); log.error("Stopping the router for a restart..."); log.logAlways(Log.WARN, "Stopping the client manager"); diff --git a/router/java/src/net/i2p/router/util/EventLog.java b/router/java/src/net/i2p/router/util/EventLog.java index d3486206ba83e25f776bd006323d578bdc2aaaf3..70eb9ea3db1333532490c36372e4164ccf1f766b 100644 --- a/router/java/src/net/i2p/router/util/EventLog.java +++ b/router/java/src/net/i2p/router/util/EventLog.java @@ -37,9 +37,11 @@ public class EventLog { public static final String CHANGE_PORT = "changePort"; public static final String CLOCK_SHIFT = "clockShift"; public static final String CRASHED = "crashed"; + public static final String CRITICAL = "critical"; public static final String INSTALLED = "installed"; public static final String INSTALL_FAILED = "intallFailed"; public static final String NEW_IDENT = "newIdent"; + public static final String OOM = "oom"; public static final String REKEYED = "rekeyed"; public static final String SOFT_RESTART = "softRestart"; public static final String STARTED = "started";