add isRouterContext() method
This commit is contained in:
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user