Changeset 8b5c0a2


Ignore:
Timestamp:
Nov 24, 2010 2:31:54 PM (10 years ago)
Author:
sponge <sponge@…>
Branches:
master
Children:
5f3834d
Parents:
dec1a9d
Message:

Plugin: ticket 104 Fix webapp isRunning to check ALL webapps.

The only defecency is that if one is running, that it considers the
entire pliugin to be running. I'm not sure if that is a good thing
or a bad thing, but the other code checks threads that way.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java

    rdec1a9d r8b5c0a2  
    5151    private static Map<String, Collection<Job>> pluginJobs = new ConcurrentHashMap<String, Collection<Job>>();
    5252    private static Map<String, ClassLoader> _clCache = new ConcurrentHashMap();
     53    private static Map<String, Collection<String>> pluginWars = new ConcurrentHashMap<String, Collection<String>>();
    5354
    5455    public PluginStarter(RouterContext ctx) {
     
    126127            String fileNames[] = webappDir.list(RouterConsoleRunner.WarFilenameFilter.instance());
    127128            if (fileNames != null) {
     129                if(!pluginWars.containsKey(appName))
     130                    pluginWars.put(appName, new ConcurrentHashSet<String>());
    128131                for (int i = 0; i < fileNames.length; i++) {
    129132                    try {
     
    140143                            String path = new File(webappDir, fileNames[i]).getCanonicalPath();
    141144                            WebAppStarter.startWebApp(ctx, server, warName, path);
     145                            pluginWars.get(appName).add(warName);
    142146                        }
    143147                    } catch (IOException ioe) {
     
    216220        Server server = WebAppStarter.getConsoleServer();
    217221        if (server != null) {
     222        /*
    218223            File consoleDir = new File(pluginDir, "console");
    219224            Properties props = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath());
     
    229234                }
    230235            }
     236        */
     237            Iterator <String> wars = pluginWars.get(appName).iterator();
     238            while (wars.hasNext()) {
     239                String warName = wars.next();
     240                WebAppStarter.stopWebApp(server, warName);
     241            }
     242            pluginWars.get(appName).clear();
    231243        }
    232244
     
    488500                    break;
    489501                }
     502        boolean isWarRunning = false;
     503        if(pluginWars.containsKey(pluginName)) {
     504            Iterator <String> it = pluginWars.get(pluginName).iterator();
     505            while(it.hasNext() && !isWarRunning) {
     506                String warName = it.next();
     507                if(WebAppStarter.isWebAppRunning(warName)) {
     508                    isWarRunning = true;
     509                }
     510            }
     511        }
    490512
    491513        if (log.shouldLog(Log.DEBUG))
    492             log.debug("plugin name = <" + pluginName + ">; threads running? " + isClientThreadRunning(pluginName) + "; webapp runing? " + WebAppStarter.isWebAppRunning(pluginName) + "; jobs running? " + isJobRunning);
    493         return isClientThreadRunning(pluginName) || WebAppStarter.isWebAppRunning(pluginName) || isJobRunning;
     514            log.debug("plugin name = <" + pluginName + ">; threads running? " + isClientThreadRunning(pluginName) + "; webapp runing? " + isWarRunning + "; jobs running? " + isJobRunning);
     515        return isClientThreadRunning(pluginName) || isWarRunning || isJobRunning;
     516        //
     517        //if (log.shouldLog(Log.DEBUG))
     518        //    log.debug("plugin name = <" + pluginName + ">; threads running? " + isClientThreadRunning(pluginName) + "; webapp runing? " + WebAppStarter.isWebAppRunning(pluginName) + "; jobs running? " + isJobRunning);
     519        //return isClientThreadRunning(pluginName) || WebAppStarter.isWebAppRunning(pluginName) || isJobRunning;
     520        //
    494521    }
    495522   
  • history.txt

    rdec1a9d r8b5c0a2  
     12010-11-24 sponge
     2    * Plugin: ticket 104 Fix webapp isRunning to check ALL webapps.
     3      The only defecency is that if one is running, that it considers the
     4      entire pliugin to be running. I'm not sure if that is a good thing
     5      or a bad thing, but the other code checks threads that way.
     6
    172010-11-22 zzz
    28    * Addressbook: Fix rename error on Windows (tkt 323 - thanks RN!)
  • router/java/src/net/i2p/router/RouterVersion.java

    rdec1a9d r8b5c0a2  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 4;
     21    public final static long BUILD = 5;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.