Package edu.byu.hbll.box.internal.core
Class DocumentProcessor
- java.lang.Object
-
- edu.byu.hbll.box.internal.core.DocumentProcessor
-
- All Implemented Interfaces:
AutoCloseable
public class DocumentProcessor extends Object implements AutoCloseable
Processes ids using theProcessor
of the source. It also handles looking up dependencies and saving documents post process.- Author:
- Charles Draper
-
-
Constructor Summary
Constructors Constructor Description DocumentProcessor(Registry registry, SourceConfig source, QuotaSemaphore quotaSemaphore)
Creates a newDocumentProcessor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
double
getAverageBatchSize()
Returns the average batch size.long
getNumBatches()
Returns the number of batches processed.long
getNumDocuments()
Returns the number of documents processed.Map<String,edu.byu.hbll.stats.time.Benchmark.Data>
getStats()
Prepares a snapshot of timing statistics for the processor.void
process(String... ids)
Submits the ids to be processed.void
process(Collection<String> ids)
Submits the ids to be processed.List<edu.byu.hbll.box.BoxDocument>
processAndWait(List<String> ids)
Processes the ids and waits.
-
-
-
Constructor Detail
-
DocumentProcessor
public DocumentProcessor(Registry registry, SourceConfig source, QuotaSemaphore quotaSemaphore)
Creates a newDocumentProcessor
.- Parameters:
registry
- the registrysource
- the source for this document processorquotaSemaphore
- the quota semaphore
-
-
Method Detail
-
process
public void process(String... ids)
Submits the ids to be processed.- Parameters:
ids
- ids to be processed
-
process
public void process(Collection<String> ids)
Submits the ids to be processed.- Parameters:
ids
- the ids to process
-
processAndWait
public List<edu.byu.hbll.box.BoxDocument> processAndWait(List<String> ids)
Processes the ids and waits.- Parameters:
ids
- the ids to process- Returns:
- the processed documents
-
getStats
public Map<String,edu.byu.hbll.stats.time.Benchmark.Data> getStats()
Prepares a snapshot of timing statistics for the processor.- Returns:
- the snapshot
-
getAverageBatchSize
public double getAverageBatchSize()
Returns the average batch size.- Returns:
- the averageBatchSize
-
getNumDocuments
public long getNumDocuments()
Returns the number of documents processed.- Returns:
- the numDocuments
-
getNumBatches
public long getNumBatches()
Returns the number of batches processed.- Returns:
- the numBatches
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-