Plugins: Order and reverse order plugin names for start/stop all cases.

This commit is contained in:
sponge
2012-03-19 12:37:39 +00:00
parent d1ed30e79c
commit 4ffbfce51e
3 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import java.net.URLClassLoader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -537,6 +538,7 @@ public class PluginStarter implements Runnable {
if (files[i].isDirectory()) if (files[i].isDirectory())
rv.add(files[i].getName()); rv.add(files[i].getName());
} }
Collections.sort(rv); // ensure the list is in sorted order.
return rv; return rv;
} }

View File

@ -1,5 +1,7 @@
package net.i2p.router.web; package net.i2p.router.web;
import java.util.Collections;
import java.util.List;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.util.Log; import net.i2p.util.Log;
@ -27,7 +29,9 @@ public class PluginStopper extends PluginStarter {
*/ */
private 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()) { List<String> pl = getPlugins();
Collections.reverse(pl); // reverse the order
for (String app : pl) {
if (isPluginRunning(app, ctx)) { if (isPluginRunning(app, ctx)) {
try { try {
stopPlugin(ctx, app); stopPlugin(ctx, app);

View File

@ -1,5 +1,6 @@
2012-03-19 sponge 2012-03-19 sponge
* Plugins: less confusing message, fix CNFE by catch and ignore on delete. * Plugins: Less confusing message, fix CNFE by catch and ignore on delete.
Order and reverse order plugin names for start/stop all cases.
2012-03-17 zzz 2012-03-17 zzz
* BuildHandler: Implement restart and shutdown to stop the thread * BuildHandler: Implement restart and shutdown to stop the thread