forked from I2P_Developers/i2p.i2p
Plugins: More thread group debugging for isRunning check;
Don't count Jetty RolloverFileOutputStream in the thread group, to fix restart of a plugin
This commit is contained in:
@ -843,9 +843,10 @@ public class PluginStarter implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isClientThreadRunning = isClientThreadRunning(pluginName, ctx);
|
||||||
if (log.shouldLog(Log.DEBUG))
|
if (log.shouldLog(Log.DEBUG))
|
||||||
log.debug("plugin name = <" + pluginName + ">; threads running? " + isClientThreadRunning(pluginName) + "; webapp runing? " + isWarRunning + "; jobs running? " + isJobRunning);
|
log.debug("plugin name = <" + pluginName + ">; threads running? " + isClientThreadRunning + "; webapp runing? " + isWarRunning + "; jobs running? " + isJobRunning);
|
||||||
return isClientThreadRunning(pluginName) || isWarRunning || isJobRunning;
|
return isClientThreadRunning || isWarRunning || isJobRunning;
|
||||||
//
|
//
|
||||||
//if (log.shouldLog(Log.DEBUG))
|
//if (log.shouldLog(Log.DEBUG))
|
||||||
// log.debug("plugin name = <" + pluginName + ">; threads running? " + isClientThreadRunning(pluginName) + "; webapp runing? " + WebAppStarter.isWebAppRunning(pluginName) + "; jobs running? " + isJobRunning);
|
// log.debug("plugin name = <" + pluginName + ">; threads running? " + isClientThreadRunning(pluginName) + "; webapp runing? " + WebAppStarter.isWebAppRunning(pluginName) + "; jobs running? " + isJobRunning);
|
||||||
@ -858,24 +859,30 @@ public class PluginStarter implements Runnable {
|
|||||||
* @param pluginName
|
* @param pluginName
|
||||||
* @return true if running
|
* @return true if running
|
||||||
*/
|
*/
|
||||||
private static boolean isClientThreadRunning(String pluginName) {
|
private static boolean isClientThreadRunning(String pluginName, RouterContext ctx) {
|
||||||
ThreadGroup group = pluginThreadGroups.get(pluginName);
|
ThreadGroup group = pluginThreadGroups.get(pluginName);
|
||||||
if (group == null)
|
if (group == null)
|
||||||
return false;
|
return false;
|
||||||
boolean rv = group.activeCount() > 0;
|
boolean rv = group.activeCount() > 0;
|
||||||
|
|
||||||
/**** debugging to figure out active threads
|
// Plugins start before the eepsite, and will create the static Timer thread
|
||||||
|
// in RolloverFileOutputStream, which never stops. Don't count it.
|
||||||
if (rv) {
|
if (rv) {
|
||||||
Thread[] activeThreads = new Thread[32];
|
Log log = ctx.logManager().getLog(PluginStarter.class);
|
||||||
|
Thread[] activeThreads = new Thread[128];
|
||||||
int count = group.enumerate(activeThreads);
|
int count = group.enumerate(activeThreads);
|
||||||
|
boolean notRollover = false;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (activeThreads[i] != null) {
|
if (activeThreads[i] != null) {
|
||||||
System.err.println("Found " + activeThreads[i].getState() + " thread for " +
|
String name = activeThreads[i].getName();
|
||||||
pluginName + ": " + activeThreads[i].getName());
|
if (!"org.eclipse.jetty.util.RolloverFileOutputStream".equals(name))
|
||||||
|
notRollover = true;
|
||||||
|
if (log.shouldLog(Log.DEBUG))
|
||||||
|
log.debug("Found " + activeThreads[i].getState() + " thread for " + pluginName + ": " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rv = notRollover;
|
||||||
}
|
}
|
||||||
****/
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user