Class NodeIndexer
- java.lang.Object
-
- org.torproject.metrics.onionoo.server.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 voidcontextDestroyed(javax.servlet.ServletContextEvent contextEvent)voidcontextInitialized(javax.servlet.ServletContextEvent contextEvent)longgetLastIndexed(long timeoutMillis)Returns the creation time of the last known node index in milliseconds since the epoch, or-1if no node index could be retrieved withintimeoutMillismilliseconds.org.torproject.metrics.onionoo.server.NodeIndexgetLatestNodeIndex(long timeoutMillis)Returns the last known node index, or null if no node index could be retrieved withintimeoutMillismilliseconds.voidrun()voidstartIndexing()Start reading the node index into memory periodically in a background thread.voidstopIndexing()Stop the background process that is periodically reading the node index.
-
-
-
Method Detail
-
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent contextEvent)
- Specified by:
contextInitializedin interfacejavax.servlet.ServletContextListener
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent contextEvent)
- Specified by:
contextDestroyedin interfacejavax.servlet.ServletContextListener
-
getLastIndexed
public long getLastIndexed(long timeoutMillis)
Returns the creation time of the last known node index in milliseconds since the epoch, or-1if no node index could be retrieved withintimeoutMillismilliseconds.
-
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 withintimeoutMillismilliseconds.
-
startIndexing
public void startIndexing()
Start reading the node index into memory periodically in a background thread.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
stopIndexing
public void stopIndexing()
Stop the background process that is periodically reading the node index.
-
-