I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 1b154551 authored by zzz's avatar zzz
Browse files

EventLog: add more events

parent c419016a
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -4,6 +4,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.router.util.EventLog;
import net.i2p.util.I2PThread; import net.i2p.util.I2PThread;
import net.i2p.util.Log; import net.i2p.util.Log;
...@@ -34,6 +35,7 @@ public class OOMListener implements I2PThread.OOMEventListener { ...@@ -34,6 +35,7 @@ public class OOMListener implements I2PThread.OOMEventListener {
try { try {
// boost priority to help us shut down // boost priority to help us shut down
// this may or may not do anything...
Thread.currentThread().setPriority(Thread.MAX_PRIORITY - 1); Thread.currentThread().setPriority(Thread.MAX_PRIORITY - 1);
} catch (OutOfMemoryError oome) {} } catch (OutOfMemoryError oome) {}
try { try {
...@@ -51,6 +53,9 @@ public class OOMListener implements I2PThread.OOMEventListener { ...@@ -51,6 +53,9 @@ public class OOMListener implements I2PThread.OOMEventListener {
try { try {
ThreadDump.dump(_context, 1); ThreadDump.dump(_context, 1);
} catch (OutOfMemoryError oome) {} } catch (OutOfMemoryError oome) {}
try {
_context.router().eventLog().addEvent(EventLog.OOM);
} catch (OutOfMemoryError oome) {}
_context.router().shutdown(Router.EXIT_OOM); _context.router().shutdown(Router.EXIT_OOM);
} }
} }
...@@ -3,6 +3,7 @@ package net.i2p.router.tasks; ...@@ -3,6 +3,7 @@ package net.i2p.router.tasks;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.RouterClock; import net.i2p.router.RouterClock;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.router.util.EventLog;
import net.i2p.util.Log; import net.i2p.util.Log;
/** /**
...@@ -16,6 +17,7 @@ public class Restarter implements Runnable { ...@@ -16,6 +17,7 @@ public class Restarter implements Runnable {
} }
public void run() { public void run() {
_context.router().eventLog().addEvent(EventLog.SOFT_RESTART);
Log log = _context.logManager().getLog(Router.class); Log log = _context.logManager().getLog(Router.class);
log.error("Stopping the router for a restart..."); log.error("Stopping the router for a restart...");
log.logAlways(Log.WARN, "Stopping the client manager"); log.logAlways(Log.WARN, "Stopping the client manager");
......
...@@ -37,9 +37,11 @@ public class EventLog { ...@@ -37,9 +37,11 @@ public class EventLog {
public static final String CHANGE_PORT = "changePort"; public static final String CHANGE_PORT = "changePort";
public static final String CLOCK_SHIFT = "clockShift"; public static final String CLOCK_SHIFT = "clockShift";
public static final String CRASHED = "crashed"; public static final String CRASHED = "crashed";
public static final String CRITICAL = "critical";
public static final String INSTALLED = "installed"; public static final String INSTALLED = "installed";
public static final String INSTALL_FAILED = "intallFailed"; public static final String INSTALL_FAILED = "intallFailed";
public static final String NEW_IDENT = "newIdent"; public static final String NEW_IDENT = "newIdent";
public static final String OOM = "oom";
public static final String REKEYED = "rekeyed"; public static final String REKEYED = "rekeyed";
public static final String SOFT_RESTART = "softRestart"; public static final String SOFT_RESTART = "softRestart";
public static final String STARTED = "started"; public static final String STARTED = "started";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment