java.lang.Object
net.i2p.util.SimpleTimer2.TimedEvent
net.i2p.router.update.NewsTimerTask
All Implemented Interfaces:
Runnable

class NewsTimerTaskextends SimpleTimer2.TimedEvent
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.

  • Field Details

    • _context

      private final RouterContext _context
      The router context.
    • _log

      private final Log _log
      The log for the news task.
    • _mgr

      private final ConsoleUpdateManager _mgr
      The update manager fetching the news.
    • _firstRun

      private volatile boolean _firstRun
      True for the first run after startup.
    • INITIAL_DELAY

      private static final long INITIAL_DELAY
      Delay before the first run.
      See Also:
    • NEW_INSTALL_DELAY

      private static final long NEW_INSTALL_DELAY
      Delay before the first run on a new install.
      See Also:
    • RUN_DELAY

      private static final long RUN_DELAY
      Delay between the runs.
      See Also:
  • Constructor Details

    • NewsTimerTask

      public NewsTimerTask(RouterContext ctx, ConsoleUpdateManager mgr)
      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 check
      mgr - 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:
      timeReached in class SimpleTimer2.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