|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.TimerTask
no.feide.moria.directory.IndexUpdater
public class IndexUpdater
This is the task responsible for periodically checking for a new index file,
and if necessary, update the existing index.
Note that this implementation relies on
no.feide.moria.directory.index.SerializableIndex
as the index
implementation. To change the index implementation, the method
readIndex()
needs to be modified.
Field Summary | |
---|---|
private java.lang.String |
filename
The location of the index file. |
private no.feide.moria.log.MessageLogger |
log
Used for logging. |
private DirectoryManager |
owner
The instance of Directory Manager that created this task. |
private long |
timestamp
The timestamp of the last read index file. |
Constructor Summary | |
---|---|
IndexUpdater(DirectoryManager dm,
java.lang.String indexFilename)
Constructor. |
Method Summary | |
---|---|
protected DirectoryManagerIndex |
readIndex()
Reads an index file and create a new index object. |
void |
run()
Performs the periodic update of the DirectoryManager's index, by calling the DirectoryManager.updateIndex(DirectoryManagerIndex)
method. |
Methods inherited from class java.util.TimerTask |
---|
cancel, scheduledExecutionTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final no.feide.moria.log.MessageLogger log
private final java.lang.String filename
private long timestamp
private final DirectoryManager owner
Constructor Detail |
---|
public IndexUpdater(DirectoryManager dm, java.lang.String indexFilename)
dm
- The instance of Directory Manager that created this instance.
Required since IndexUpdater
uses this object
directly to update its index. Cannot be null
.indexFilename
- The index filename. Cannot be null
.
java.lang.NullPointerException
- If dm
or indexFilename
is
null
.Method Detail |
---|
public final void run()
DirectoryManager.updateIndex(DirectoryManagerIndex)
method.
run
in interface java.lang.Runnable
run
in class java.util.TimerTask
Runnable.run()
,
DirectoryManager.updateIndex(DirectoryManagerIndex)
protected final DirectoryManagerIndex readIndex()
DirectoryManager.setConfig(Properties)
to force through an
initial update of the index.
DirectoryManagerIndex
interface. Will return
null
if this method has already been used to
successfully read an index file, and the file has not been
updated since (based on the file's timestamp on disk, as per the
File.lastModified()
method).File.lastModified()
,
DirectoryManager.setConfig(java.util.Properties)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |