Class ArtifactProducer
java.lang.Object
org.apache.uima.collection.impl.cpm.engine.ArtifactProducer
- All Implemented Interfaces:
- Runnable
Component responsible for continuously filling a work queue with bundles containing Cas'es. The
 queue is shared with a Processing Pipeline that consumes bundles of Cas. As soon as the the
 bundle is removed from the queue, this component fetches data from configured Collection Reader
 and enques it onto the queue. This component facilitates asynchronous reading and processing of
 CAS by seperate threads running in the CPE.
 
 When end of processing is reached due to CPM shutdown or max number of entities are processed a
 special token, called EOFToken is placed onto a queue. It marks end of processing for Processing
 Units. No more data is expected to be placed on the work queue. The Processing Threads upon
 seeing the EOFToken are expected to complete processing and do necessary cleanup.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionArtifactProducer(CPMEngine acpm) Instantiates and initializes this instance.ArtifactProducer(CPMEngine acpm, CPECasPool aPool) Construct instance of this class with a reference to the cpe engine and a pool of cas'es.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcleanup()Null out fields of this object.voidFills the queue up to capacity.longReturns total time spent when fetching entities from a CollectionReader.Gets the last doc id.voidinvalidate(CAS[] aCasList) Invalidate.booleanChecks if is running.voidrun()Runs this thread until the CPM halts or the CollectionReader has no more entities.voidsetCollectionReader(BaseCollectionReader aCollectionReader) Assign CollectionReader to be used for reading.voidsetCPMStatTable(Map aStatTable) Add table that will contain statistics gathered while reading entities from a Collection This table is used for non-uima reports.voidsetNumEntitiesToProcess(long aNumToProcess) Assign total number of entities to process.voidsetProcessTrace(ProcessTrace aProcTrace) Sets the process trace.voidsetUimaTimer(UimaTimer aTimer) Plug in Custom Timer to time events.voidsetWorkQueue(BoundedWorkQueue aQueue) Assigns a queue where the artifacts produced by this component will be deposited.
- 
Field Details- 
threadStatepublic int threadStateThe thread state.
 
- 
- 
Constructor Details- 
ArtifactProducerInstantiates and initializes this instance.- Parameters:
- acpm- the acpm
 
- 
ArtifactProducerConstruct instance of this class with a reference to the cpe engine and a pool of cas'es.- Parameters:
- acpm- - reference to the cpe
- aPool- - pool of cases
 
 
- 
- 
Method Details- 
isRunningpublic boolean isRunning()Checks if is running.- Returns:
- true, if is running
 
- 
setUimaTimerPlug in Custom Timer to time events.- Parameters:
- aTimer- - custom timer
 
- 
setProcessTraceSets the process trace.- Parameters:
- aProcTrace- the new process trace
 
- 
getCollectionReaderTotalFetchTimepublic long getCollectionReaderTotalFetchTime()Returns total time spent when fetching entities from a CollectionReader. This provides a way of gauging throughput of a particular CR.- Returns:
- total time spent when fetching entities. -1 when the fetch time is unknown.
 
- 
cleanuppublic void cleanup()Null out fields of this object. Call this only when this object is no longer needed.
- 
setNumEntitiesToProcesspublic void setNumEntitiesToProcess(long aNumToProcess) Assign total number of entities to process.- Parameters:
- aNumToProcess- - number of entities to read from the Collection Reader
 
- 
setCollectionReaderAssign CollectionReader to be used for reading.- Parameters:
- aCollectionReader- - collection reader as source of data
 
- 
setWorkQueueAssigns a queue where the artifacts produced by this component will be deposited.- Parameters:
- aQueue- - queue for the artifacts this class is producing
 
- 
setCPMStatTableAdd table that will contain statistics gathered while reading entities from a Collection This table is used for non-uima reports.- Parameters:
- aStatTable- the new CPM stat table
 
- 
fillQueueFills the queue up to capacity. This is called before activating ProcessingPipeline as means of optimizing processing. When pipelines start up there are already entities in the work queue to process.- Throws:
- Exception- the exception
 
- 
runpublic void run()Runs this thread until the CPM halts or the CollectionReader has no more entities. It continuously fills the work queue with entities returned by the CollectionReader.
- 
getLastDocIdGets the last doc id.- Returns:
- the last doc id
 
- 
invalidateInvalidate.- Parameters:
- aCasList- the a cas list
 
 
-