From 1b154551a2c608ceed213bf93698729ad8f69215 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Tue, 9 Oct 2012 10:35:47 +0000 Subject: [PATCH] EventLog: add more events --- router/java/src/net/i2p/router/tasks/OOMListener.java | 5 +++++ router/java/src/net/i2p/router/tasks/Restarter.java | 2 ++ router/java/src/net/i2p/router/util/EventLog.java | 2 ++ 3 files changed, 9 insertions(+) diff --git a/router/java/src/net/i2p/router/tasks/OOMListener.java b/router/java/src/net/i2p/router/tasks/OOMListener.java index a5e4ea49e1..1662b9ffe8 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 2d497abb4b..c904cad507 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 d3486206ba..70eb9ea3db 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"; -- GitLab