minor console/update cleanups

This commit is contained in:
zzz
2012-12-22 18:37:26 +00:00
parent 81975e919b
commit 470b8c59e7
3 changed files with 10 additions and 3 deletions

View File

@ -558,6 +558,11 @@ public class ConsoleUpdateManager implements UpdateManager {
* Call once for each type/method pair. * Call once for each type/method pair.
*/ */
public void register(Updater updater, UpdateType type, UpdateMethod method, int priority) { public void register(Updater updater, UpdateType type, UpdateMethod method, int priority) {
if ((type == ROUTER_SIGNED || type == ROUTER_UNSIGNED) && NewsHelper.dontInstall(_context)) {
if (_log.shouldLog(Log.WARN))
_log.warn("Ignoring registration for " + type + ", router updates disabled");
return;
}
// DEBUG slow start for snark updates // DEBUG slow start for snark updates
// For 0.9.4 update, only for dev builds // For 0.9.4 update, only for dev builds
// For 0.9.5 update, only for dev builds and 1% more // For 0.9.5 update, only for dev builds and 1% more

View File

@ -230,10 +230,12 @@ public class NewsHelper extends ContentHelper {
* @since 0.9.4 moved from NewsFetcher * @since 0.9.4 moved from NewsFetcher
*/ */
public static boolean dontInstall(RouterContext ctx) { public static boolean dontInstall(RouterContext ctx) {
boolean disabled = ctx.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_DISABLED);
if (disabled)
return true;
File test = new File(ctx.getBaseDir(), "history.txt"); File test = new File(ctx.getBaseDir(), "history.txt");
boolean readonly = ((test.exists() && !test.canWrite()) || (!ctx.getBaseDir().canWrite())); boolean readonly = ((test.exists() && !test.canWrite()) || (!ctx.getBaseDir().canWrite()));
boolean disabled = ctx.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_DISABLED); return readonly;
return readonly || disabled;
} }
/** /**

View File

@ -55,7 +55,7 @@ public class StatSummarizer implements Runnable {
private Thread _thread; private Thread _thread;
public StatSummarizer() { public StatSummarizer() {
_context = RouterContext.listContexts().get(0); // fuck it, only summarize one per jvm _context = RouterContext.listContexts().get(0); // 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;