public class NodeIndexer
extends java.lang.Object
implements javax.servlet.ServletContextListener, java.lang.Runnable
Constructor and Description |
---|
NodeIndexer() |
Modifier and Type | Method and 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.
|
public void contextInitialized(javax.servlet.ServletContextEvent contextEvent)
contextInitialized
in interface javax.servlet.ServletContextListener
public void contextDestroyed(javax.servlet.ServletContextEvent contextEvent)
contextDestroyed
in interface javax.servlet.ServletContextListener
public long getLastIndexed(long timeoutMillis)
-1
if no node index
could be retrieved within timeoutMillis
milliseconds.public org.torproject.metrics.onionoo.server.NodeIndex getLatestNodeIndex(long timeoutMillis)
timeoutMillis
milliseconds.public void startIndexing()
public void run()
run
in interface java.lang.Runnable
public void stopIndexing()