add isRouterContext() method

This commit is contained in:
zzz
2009-12-19 16:37:44 +00:00
parent 55682810b1
commit 08e54c515e
3 changed files with 17 additions and 2 deletions

View File

@ -179,7 +179,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
if (get.fetch()) {
String lastmod = get.getLastModified();
if (lastmod != null) {
if (!(_context instanceof RouterContext)) return;
if (!(_context.isRouterContext())) return;
long modtime = parse822Date(lastmod);
if (modtime <= 0) return;
String lastUpdate = _context.getProperty(UpdateHandler.PROP_LAST_UPDATE_TIME);
@ -310,7 +310,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Policy requests update, so we update");
UpdateHandler handler = null;
if (_context instanceof RouterContext) {
if (_context.isRouterContext()) {
handler = new UpdateHandler((RouterContext)_context);
} else {
List contexts = RouterContext.listContexts();

View File

@ -722,4 +722,11 @@ public class I2PAppContext {
return new HashSet(_shutdownTasks);
}
/**
* Use this instead of context instanceof RouterContext
* @since 0.7.9
*/
public boolean isRouterContext() {
return false;
}
}

View File

@ -379,4 +379,12 @@ public class RouterContext extends I2PAppContext {
}
}
/**
* Use this instead of context instanceof RouterContext
* @return true
* @since 0.7.9
*/
public boolean isRouterContext() {
return true;
}
}