java.lang.Object
net.i2p.util.SimpleTimer2.TimedEvent
net.i2p.router.update.NewsTimerTask
- All Implemented Interfaces:
Runnable
Task to periodically look for updates to the news.xml, and to keep track of whether that has an announcement for a new version. Also looks for unsigned updates.
Runs forever on instantiation, can't be stopped.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classDon't clog the scheduler when fetching the news.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router context.private booleanTrue for the first run after startup.private final LogThe log for the news task.private final ConsoleUpdateManagerThe update manager fetching the news.private static final longDelay before the first run.private static final longDelay before the first run on a new install.private static final longDelay between the runs.Fields inherited from class SimpleTimer2.TimedEvent
_state, DEFAULT_FUZZModifier and TypeFieldDescriptionprotected SimpleTimer2.TimedEventStateState of the current event.protected static final intDefault fuzz threshold in milliseconds.Constructor Summary
ConstructorsConstructorDescriptionNewsTimerTask(RouterContext ctx, ConsoleUpdateManager mgr) Schedules the recurring news check and runs the first one now.Method Summary
Modifier and TypeMethodDescriptionprivate voidFetch news updates from the configured feed.private booleanWhether dev SU3 fetching is enabled.private booleanWhether to fetch the news now.private booleanWhether to fetch unsigned news.voidRe-arms the check, fetching news or resuming an install when warranted.Methods inherited from class SimpleTimer2.TimedEvent
cancel, forceReschedule, reschedule, reschedule, run, schedule, setFuzz, setPool, toStringModifier and TypeMethodDescriptionbooleancancel()Cancel the timed event.voidforceReschedule(long timeoutMs) Always use the new time - ignores fuzz.voidreschedule(long timeoutMs) Use the earliest of the new time and the old time May be called from within timeReached(), but schedule() is better there.voidreschedule(long timeoutMs, boolean useEarliestTime) May be called from within timeReached(), but schedule() is better there.voidrun()voidschedule(long timeoutMs) Schedule this event.voidsetFuzz(int fuzz) Reschedule threshold in ms.voidsetPool(SimpleTimer2 pool) Timer pool for this event.toString()Timer summary for log messages.
Field Details
_context
The router context._log
The log for the news task._mgr
The update manager fetching the news._firstRun
private volatile boolean _firstRunTrue for the first run after startup.INITIAL_DELAY
NEW_INSTALL_DELAY
private static final long NEW_INSTALL_DELAYDelay before the first run on a new install.- See Also:
RUN_DELAY
Constructor Details
NewsTimerTask
Schedules the recurring news check and runs the first one now.- Parameters:
ctx- the router context, whose simple timer and random source schedule the recurring checkmgr- the update manager consulted to decide whether a fetch or an install is warranted
Method Details
timeReached
public void timeReached()Re-arms the check, fetching news or resuming an install when warranted.- Specified by:
timeReachedin classSimpleTimer2.TimedEvent
shouldFetchNews
private boolean shouldFetchNews()Whether to fetch the news now.- Returns:
- true when it is time to fetch
fetchNews
private void fetchNews()Fetch news updates from the configured feed.shouldFetchUnsigned
private boolean shouldFetchUnsigned()Whether to fetch unsigned news.- Returns:
- true when unsigned news is allowed
shouldFetchDevSU3
private boolean shouldFetchDevSU3()Whether dev SU3 fetching is enabled.- Returns:
- true if a dev SU3 URL is set, the dev SU3 update property is enabled, and news installation is not disabled