Class NodeIndexer

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.EventListener, javax.servlet.ServletContextListener

    public class NodeIndexer
    extends java.lang.Object
    implements javax.servlet.ServletContextListener, java.lang.Runnable
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeIndexer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void contextDestroyed​(javax.servlet.ServletContextEvent contextEvent)  
      void contextInitialized​(javax.servlet.ServletContextEvent contextEvent)  
      long getLastIndexed​(long timeoutMillis)
      Returns the creation time of the last known node index in milliseconds since the epoch, or -1 if no node index could be retrieved within timeoutMillis milliseconds.
      org.torproject.metrics.onionoo.server.NodeIndex getLatestNodeIndex​(long timeoutMillis)
      Returns the last known node index, or null if no node index could be retrieved within timeoutMillis milliseconds.
      void run()  
      void startIndexing()
      Start reading the node index into memory periodically in a background thread.
      void stopIndexing()
      Stop the background process that is periodically reading the node index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NodeIndexer

        public NodeIndexer()
    • Method Detail

      • contextInitialized

        public void contextInitialized​(javax.servlet.ServletContextEvent contextEvent)
        Specified by:
        contextInitialized in interface javax.servlet.ServletContextListener
      • contextDestroyed

        public void contextDestroyed​(javax.servlet.ServletContextEvent contextEvent)
        Specified by:
        contextDestroyed in interface javax.servlet.ServletContextListener
      • getLastIndexed

        public long getLastIndexed​(long timeoutMillis)
        Returns the creation time of the last known node index in milliseconds since the epoch, or -1 if no node index could be retrieved within timeoutMillis milliseconds.
      • getLatestNodeIndex

        public org.torproject.metrics.onionoo.server.NodeIndex getLatestNodeIndex​(long timeoutMillis)
        Returns the last known node index, or null if no node index could be retrieved within timeoutMillis milliseconds.
      • startIndexing

        public void startIndexing()
        Start reading the node index into memory periodically in a background thread.
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • stopIndexing

        public void stopIndexing()
        Stop the background process that is periodically reading the node index.