forked from I2P_Developers/i2p.i2p
cleanup
This commit is contained in:
@ -9,19 +9,19 @@ class ContextHelper {
|
|||||||
|
|
||||||
/** @throws IllegalStateException if no context available */
|
/** @throws IllegalStateException if no context available */
|
||||||
public static RouterContext getContext(String contextId) {
|
public static RouterContext getContext(String contextId) {
|
||||||
List contexts = RouterContext.listContexts();
|
List<RouterContext> contexts = RouterContext.listContexts();
|
||||||
if ( (contexts == null) || (contexts.isEmpty()) )
|
if ( (contexts == null) || (contexts.isEmpty()) )
|
||||||
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
|
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
|
||||||
if ( (contextId == null) || (contextId.trim().length() <= 0) )
|
if ( (contextId == null) || (contextId.trim().length() <= 0) )
|
||||||
return (RouterContext)contexts.get(0);
|
return contexts.get(0);
|
||||||
for (int i = 0; i < contexts.size(); i++) {
|
for (int i = 0; i < contexts.size(); i++) {
|
||||||
RouterContext context = (RouterContext)contexts.get(i);
|
RouterContext context = contexts.get(i);
|
||||||
Hash hash = context.routerHash();
|
Hash hash = context.routerHash();
|
||||||
if (hash == null) continue;
|
if (hash == null) continue;
|
||||||
if (hash.toBase64().startsWith(contextId))
|
if (hash.toBase64().startsWith(contextId))
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
// not found, so just give them the first we can find
|
// not found, so just give them the first we can find
|
||||||
return (RouterContext)contexts.get(0);
|
return contexts.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class StatSummarizer implements Runnable {
|
|||||||
private Thread _thread;
|
private Thread _thread;
|
||||||
|
|
||||||
public StatSummarizer() {
|
public StatSummarizer() {
|
||||||
_context = (RouterContext)RouterContext.listContexts().get(0); // fuck it, only summarize one per jvm
|
_context = RouterContext.listContexts().get(0); // fuck it, only summarize one per jvm
|
||||||
_log = _context.logManager().getLog(getClass());
|
_log = _context.logManager().getLog(getClass());
|
||||||
_listeners = new CopyOnWriteArrayList();
|
_listeners = new CopyOnWriteArrayList();
|
||||||
_instance = this;
|
_instance = this;
|
||||||
|
Reference in New Issue
Block a user