- Only stop a plugin at shutdown if it was running

This commit is contained in:
zzz
2012-01-15 21:30:15 +00:00
parent fc6f4ecc74
commit 0cee758dc3

View File

@ -4,7 +4,7 @@ import net.i2p.router.RouterContext;
import net.i2p.util.Log; import net.i2p.util.Log;
/** /**
* Stop all plugins that are installed * Stop all plugins that are installed and running
* *
* @since 0.7.13 * @since 0.7.13
* @author zzz * @author zzz
@ -21,19 +21,20 @@ public class PluginStopper extends PluginStarter {
} }
/** /**
* Stop all plugins * Stop all running plugins
* (whether or not they were ever started)
* *
* this shouldn't throw anything * this shouldn't throw anything
*/ */
static void stopPlugins(RouterContext ctx) { private static void stopPlugins(RouterContext ctx) {
Log log = ctx.logManager().getLog(PluginStopper.class); Log log = ctx.logManager().getLog(PluginStopper.class);
for (String app : getPlugins()) { for (String app : getPlugins()) {
try { if (isPluginRunning(app, ctx)) {
stopPlugin(ctx, app); try {
} catch (Throwable e) { stopPlugin(ctx, app);
if (log.shouldLog(Log.WARN)) } catch (Throwable e) {
log.warn("Failed to stop plugin: " + app, e); if (log.shouldLog(Log.WARN))
log.warn("Failed to stop plugin: " + app, e);
}
} }
} }
} }