public class EntityTimerProcessor extends Object implements EntityDocumentDumpProcessor
EntityDocumentProcessor
for basic counting and time keeping.
It will print statistics on elapsed time and processed entities once in a
while. The class also supports a timeout mechanism: if a timeout time (in
seconds) is given, then a EntityTimerProcessor.TimeoutException
(unchecked) will be thrown soon after this many seconds have passed. This can
be used to abort processing in a relatively clean way by catching this
exception at a higher level.Modifier and Type | Class and Description |
---|---|
static class |
EntityTimerProcessor.TimeoutException |
Constructor and Description |
---|
EntityTimerProcessor(int timeout)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Stops the processing and prints the final time.
|
void |
open()
Starts the processing by performing any initial steps to prepare
processing.
|
void |
processItemDocument(ItemDocument itemDocument)
Processes the given ItemDocument.
|
void |
processPropertyDocument(PropertyDocument propertyDocument)
Processes the given PropertyDocument.
|
void |
setReportInterval(int seconds)
Sets the interval after which the timer should report progress.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
processEntityRedirectDocument, processLexemeDocument, processMediaInfoDocument
public EntityTimerProcessor(int timeout)
timeout
- the timeout in seconds or 0 if no timeout should be usedpublic void setReportInterval(int seconds)
seconds
- time after which progress should be reported.public void processItemDocument(ItemDocument itemDocument)
EntityDocumentProcessor
processItemDocument
in interface EntityDocumentProcessor
itemDocument
- the ItemDocumentpublic void processPropertyDocument(PropertyDocument propertyDocument)
EntityDocumentProcessor
processPropertyDocument
in interface EntityDocumentProcessor
propertyDocument
- the PropertyDocumentpublic void open()
EntityDocumentDumpProcessor
open
in interface EntityDocumentDumpProcessor
public void close()
close
in interface EntityDocumentDumpProcessor
Copyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage