java.lang.Object
net.i2p.addressbook.HostCheckerBridge

public class HostCheckerBridgeextends Object
Bridge class to provide static access to HostChecker functionality for JSP pages This avoids reflection issues and provides a clean interface.
  • Field Details

    • hostChecker

      private static HostChecker hostChecker
      The shared checker, created on first use.
    • lock

      private static final Object lock
      Guards creating and replacing the checker.
  • Constructor Details

    • HostCheckerBridge

      public HostCheckerBridge()
      Constructor. The checker is held in a static field set by Daemon, so an instance carries no state of its own.
  • Method Details

    • getInstance

      public static HostChecker getInstance()
      Get singleton HostChecker instance This should be set by Daemon.java to avoid duplicate instances.
      Returns:
      the shared HostChecker, or null before Daemon sets it
    • setInstance

      public static void setInstance(HostChecker checker)
      Set HostChecker instance (should be called by Daemon.java).
      Parameters:
      checker - the shared HostChecker that addressbook calls will ping through
    • ping

      public static Map<String,String> ping(String host)
      Ping a single host and return as result as a Map.
      Parameters:
      host - hostname to ping
      Returns:
      Map containing ping results (status, reachable, responseTime, timestamp)
    • getAllPingResults

      public static Map<String, HostChecker.PingResult> getAllPingResults()
      Get all current ping results.
      Returns:
      Map of all ping results
    • startPeriodicChecking

      public static void startPeriodicChecking()
      Start periodic ping checking.
    • stopPeriodicChecking

      public static void stopPeriodicChecking()
      Stop periodic ping checking.
    • runCheckNow

      public static void runCheckNow()
      Run a host check cycle immediately, unless one is already running.
    • isScanRunning

      public static boolean isScanRunning()
      Whether a host check cycle is currently in progress.
      Returns:
      true if a cycle is running
    • getCategoryDescription

      public static String getCategoryDescription(String category)
      Get description for a category.
      Parameters:
      category - category name
      Returns:
      category description, or category itself if unknown