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 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 withintimeoutMillis
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 withintimeoutMillis
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.
-
-
-
Method Detail
-
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent contextEvent)
- Specified by:
contextInitialized
in interfacejavax.servlet.ServletContextListener
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent contextEvent)
- Specified by:
contextDestroyed
in 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-1
if no node index could be retrieved withintimeoutMillis
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 withintimeoutMillis
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 interfacejava.lang.Runnable
-
stopIndexing
public void stopIndexing()
Stop the background process that is periodically reading the node index.
-
-