I2PTunnel:

- Fix bug that left server acceptor thread running after close
- Add destroy() methods to release all resources when closing a tunnel for good,
  particularly the streaming timer threads
- Use COWAL to prevent concurrency problems
- Javadocs
Streaming:
- Don't return null from accept() any more; actually throw
  ConnectException as the javadocs have always specified
- Throw ConnectException from accept() if interrupted; previously caught and ignored
- Throw exceptions from ConnectionHandler.accept(), not higher up
- Close ServerSocket when ConnectionManager is shut down
- Synchronize setActive(), clear queue when starting to accept,
  better handling of calls that don't change state
- Javadocs
ConfigClientsHelper: Call isPluginRunning() less often
PluginStarter: Simplify detection of active threads

Above changes mostly in support of zzzot plugin implementing ClientApp
and being able to shut down completely so there are no threads
in its thread group, so /configclients will all show status as stopped.
Previously, the I2PTunnelServer acceptor thread and
one or more streaming timer threads would remain.
This commit is contained in:
zzz
2014-11-13 20:12:55 +00:00
parent 0773a30578
commit 2f2aa7f5a8
16 changed files with 283 additions and 76 deletions

View File

@ -261,9 +261,9 @@ public class ConfigClientsHelper extends HelperBase {
.append("<a href=\"").append(updateURL).append("\">").append(_("Update link")).append("</a><td>&nbsp;");
}
desc.append("</table>");
boolean enableStop = !Boolean.parseBoolean(appProps.getProperty("disableStop"));
enableStop &= PluginStarter.isPluginRunning(app, _context);
boolean enableStart = !PluginStarter.isPluginRunning(app, _context);
boolean isRunning = PluginStarter.isPluginRunning(app, _context);
boolean enableStop = isRunning && !Boolean.parseBoolean(appProps.getProperty("disableStop"));
boolean enableStart = !isRunning;
renderForm(buf, app, app, false,
"true".equals(val), false, false, desc.toString(), false, false,
updateURL != null, enableStop, true, enableStart);

View File

@ -862,10 +862,22 @@ public class PluginStarter implements Runnable {
ThreadGroup group = pluginThreadGroups.get(pluginName);
if (group == null)
return false;
boolean rv = group.activeCount() > 0;
Thread[] activeThreads = new Thread[1];
group.enumerate(activeThreads);
return activeThreads[0] != null;
/**** debugging to figure out active threads
if (rv) {
Thread[] activeThreads = new Thread[32];
int count = group.enumerate(activeThreads);
for (int i = 0; i < count; i++) {
if (activeThreads[i] != null) {
System.err.println("Found " + activeThreads[i].getState() + " thread for " +
pluginName + ": " + activeThreads[i].getName());
}
}
}
****/
return rv;
}
/**