diff --git a/history.txt b/history.txt index 40d960fd3445c861271e89e7d6421bdf7e75fabc..74e4e2d125a15aaea3aa32622ef7322781f2b3a7 100644 --- a/history.txt +++ b/history.txt @@ -8,6 +8,7 @@ - Reduce delay between peer adds for faster startup - Thread the announces and reduce timeout when stopping * NativeBigInteger: Workaround for Raspberry Pi to load the correct lib + * Router: Don't let shutdown tasks hang the shutdown 2012-06-08 zzz * i2psnark: diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index 4a627cd8a3e0575911cdc24a36e044d3653b1d26..d97c5737b14a9ae833ec5383d6d0bac4b7ed243f 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -775,7 +775,15 @@ public class Router implements RouterClock.ClockShiftListener { if (_log.shouldLog(Log.WARN)) _log.warn("Running shutdown task " + task.getClass()); try { - task.run(); + //task.run(); + Thread t = new Thread(task, "Shutdown task " + task.getClass().getName()); + t.setDaemon(true); + t.start(); + try { + t.join(10*1000); + } catch (InterruptedException ie) {} + if (t.isAlive()) + _log.logAlways(Log.WARN, "Shutdown task took more than 10 seconds to run: " + task.getClass()); } catch (Throwable t) { _log.log(Log.CRIT, "Error running shutdown task", t); }