Class CPMEngine
java.lang.Object
org.apache.uima.collection.impl.cpm.engine.CPMEngine
- All Implemented Interfaces:
Runnable
Responsible for creating and initializing processing threads. This instance manages the
life-cycle of the CPE components. It exposes API for plugging in components programmatically
instead of declaratively. Running in its own thread, this components creates separate Processing
Pipelines for Analysis Engines and CAS Consumers, launches configured CollectionReader and
attaches all of those components to form a pipeline from source to sink. The Collection Reader
feeds Processing Threads containing Analysis Engines, and Analysis Engines feed results of
analysis to CAS Consumers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe active processing units.private HashtableThe analysis engines.private LinkedListThe annotator deploy list.private LinkedListThe annotator list.private static final intThe Constant CAS_PROCESSED_MSG.private ProcessingUnitThe cas consumer PU.private Future<?> The CAS pool.private CasProcessor[]The casprocessor list.private booleanThe cas processors deployed.private CheckpointDataThe checkpoint data.private BaseCollectionReaderThe collection reader.private intThe concurrent thread count.private LinkedListThe consumer deploy list.private LinkedListThe consumer list.private HashtableThe consumers.private booleanThe consumer thread started.private CPEFactoryThe cpe factory.private longThe cr fetch time.private DebugControlThreadThe dbg ctrl thread.private Capability[]The defined capabilities.private booleanThe drop cas on exception policy.private final CPMExecutorServiceprivate booleanThe hard kill.private LinkedListThe initial cp list.private intThe input queue size.protected booleanThe is running.protected booleanThe killed.final ObjectThe lock for pause.private static final intThe Constant MAX_WAIT_ON_QUEUE.private booleanThe mixed cas processor type support.private PropertiesThe m performance tuning settings.private booleanThe needs T cas.private NonThreadedProcessingUnitThe non threaded cas consumer processing unit.private NonThreadedProcessingUnitThe non threaded processing unit.private longThe num to process.protected BoundedWorkQueueThe output queue.private intThe output queue size.protected booleanThe pause.private booleanThe pause on exception.private ProcessControllerAdapterThe pca.private intThe pool size.private int[]The processing threads state.protected Future<?>[]protected ProcessingUnit[]The processing units.private ProcessTraceThe proc tr.private ArtifactProducerThe producer.private Future<?> private intThe reader fetch size.private intThe reader state.private booleanThe reader thread started.private static final StringThe Constant SINGLE_THREADED_MODE.private booleanThe single threaded CPE.private HashtableThe skipped docs.private MapThe stats.private ArrayListThe status cb L.protected booleanThe stopped.protected BoundedWorkQueueThe work queue. -
Constructor Summary
ConstructorsConstructorDescriptionCPMEngine(CPMExecutorService aExecutorService, CPEFactory aCpeFactory, ProcessTrace aProcTr, CheckpointData aCheckpointData) Initializes Collection Processing Engine. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddCasConsumer(CasProcessor aProcessor, String aCpName) Adds Cas Processor to a single-threaded pipeline.voidaddCasProcessor(CasProcessor aCasProcessor) Adds a CASProcessor to the processing pipeline.voidaddCasProcessor(CasProcessor aCasProcessor, int aIndex) Adds a CASProcessor to the processing pipeline at a given place in the processing pipeline.private voidaddParallizableCasProcessor(CasProcessor aProcessor, String aCpName) Add Cas Processor to a list of CPs that are to be run in the parallelizable pipeline.voidAdds the status callback listener.voidDeprecated.private voidInitialize the CPE.static voidcallEntityProcessCompleteWithCAS(StatusCallbackListener statCL, CAS cas, EntityProcessStatus eps) Internal use only, public for cross package access.private voidCall typeSystemInit method on each component.private voidClassify based on Cas Processor capability to run in parallel.voidcleanup()Null out fields of this object.private voidcopyComponentEvents(String aEvType, List aList, ProcessTrace aPTr) Copy given component events.private BoundedWorkQueuecreateOutputQueue(int aQueueSize) Instantiate custom Output Queue.private voidDeploys All Analysis Engines.voidStarts CASProcessor containers one a time.private voidDeploys all Cas Consumers.voiddisableCasProcessor(int aCasProcessorIndex) Disable a CASProcessor in the processing pipeline.voiddisableCasProcessor(String aCasProcessorName) Disable a CASProcessor in the processing pipeline.booleanDrop cas on exception.private voidDumps some internal state of the CPE.voidenableCasProcessor(String aCasProcessorName) Disable a CASProcessor in the processing pipeline.private booleanendOfProcessingReached(long entityCount) Determines if the CPM processed all documents.private voidPlace EOF Token onto a work queue to force thread exit.Returns a list of All Processing Containers.Returns a list of ALL callback listeners currently registered with the CPM.Returns all CASProcesors in the processing pipeline.private ObjectgetCasWithSOFA(Object entity, ProcessTrace pTrTemp) Gets the cas with SOFA.protected CpeConfigurationGets the cpe config.(package private) CPMExecutorServiceprivate intgetIndexInList(List aDeployList, String aName) Returns index to a CasProcessor with a given name in a given List.Gets the last doc repository.Returns Id of the last document processed.Gets the performance tuning settings.intGets the pool size.private intgetPositionInListIfExists(String aName, List aList) Find the position in the list of the Cas Processor with a given name.Returns a list of Processing Containers for Analysis Engines.private ProcessTraceGets the process trace.Progress[]Returns collectionReader progress.private HashMapgetStatForContainer(ProcessingContainer aContainer) Gets the stat for container.getStats()Returns CPE stats.intReturns number of processing threads.private UimaTimergetTimer()Return timer to measure performace of the cpm.private voidhandleException(Throwable t, Object[] entity, ProcessTrace aPTrace) Handle given exception.voidinvalidateCASes(CAS[] aCASList) Invalidate CA ses.booleanReturns if the CPE was killed hard.booleanisKilled()Returns true if this engine has been killed.private booleanisMultipleDeploymentAllowed(String aDescPath, String aCpName, boolean isConsumer) Parses Cas Processor descriptor and checks if it is parallelizable.booleanisParallizable(CasProcessor aProcessor, String aCpName) Determines if a given Cas Processor is parallelizable.booleanisPaused()Returns a global flag indicating if this Thread is in pause state.booleanReturns if the CPM should pause when exception occurs.private booleanisProcessorReady(int aStatus) Check if the CASProcessor status is available for processing.booleanReturns a global flag indicating if this Thread is in processing state.voidkillIt()Kill CPM the hard way.private booleanNeeds view.private voidnotifyListeners(int aMsgType, Object[] entity, ProcessTrace aPTrace) Notify listeners.private voidnotifyListeners(int aMsgType, Object[] entity, ProcessTrace aPTrace, Throwable t) Notify listeners.private voidNotify listeners of a given exception.voidpauseIt()Pauses this thread.voidpipelineKilled(String aPipelineThreadName) Callback method used to notify the engine when a processing pipeline is killed due to excessive errors.(package private) voidCalled from the ProcessingUnits when they shutdown due to having received the EOFToken.private ProcessingUnitInstantiate custom Processing Pipeline.voidredeployAnalysisEngine(ProcessingContainer aProcessingContainer) Deploys CasProcessor and associates it with aProcessingContainer.private voidRegisters Type Systems of all components with the CasManager.voidreleaseCASes(CAS[] aCASList) Releases given cases back to pool.voidremoveCasProcessor(int aCasProcessorIndex) Removes a CASProcessor from the processing pipeline.voidUnregisters given listener from the CPM.private voidrestoreFromCheckpoint(String component, String aEvType) Restores named events from the checkpoint.voidresumeIt()Resumes this thread.voidrun()Using given configuration creates and starts CPE processing pipeline.voidRuns the CPE in a single thread without queues.private voidsaveStat(String aStatLabel, String aStatValue, ProcessingContainer aContainer) Save stat.voidsetCollectionReader(BaseCollectionReader aCollectionReader) Sets CollectionReader to use during processing.voidsetConcurrentThreadSize(int aConcurrentThreadSize) Defines number of threads executing the processing pipeline concurrently.voidsetInputQueueSize(int aInputQueueSize) Defines the size of inputQueue.voidsetNumToProcess(long aNumToProcess) Defines the size of the batch.voidsetOutputQueueSize(int aOutputQueueSize) Defines the size of outputQueue.voidsetPauseOnException(boolean aPause) Sets a global flag to indicate to the CPM that it should pause whenever exception occurs.voidsetPerformanceTuningSettings(Properties aPerformanceTuningSettings) Overrides the default performance tuning settings for this CPE.voidsetPoolSize(int aPoolSize) Defines the size of Cas Pool.voidSets the process controller adapter.voidPlugs in a map where the engine stores perfomance info at runtime.private voidSetup Cas Consumer pipeline as single threaded.private voidSetup single threaded pipeline.private booleanskipDroppedDocument(Object[] entity) Determines if a given CAS should be skipped.private voidStart debug control thread.voidstopCasProcessors(boolean kill) Stops All Cas Processors and optionally changes the status according to kill flag.voidstopIt()Stops execution of the Processing Pipeline and this thread.private voidStop and cleanup single-threaded CPE.private voidWait for CPM to resume if paused.
-
Field Details
-
MAX_WAIT_ON_QUEUE
private static final int MAX_WAIT_ON_QUEUEThe Constant MAX_WAIT_ON_QUEUE.- See Also:
-
CAS_PROCESSED_MSG
private static final int CAS_PROCESSED_MSGThe Constant CAS_PROCESSED_MSG.- See Also:
-
SINGLE_THREADED_MODE
The Constant SINGLE_THREADED_MODE.- See Also:
-
executorService
-
casPool
The CAS pool. -
lockForPause
The lock for pause. -
collectionReader
The collection reader. -
pause
protected boolean pauseThe pause. -
isRunning
protected volatile boolean isRunningThe is running. -
stopped
protected volatile boolean stoppedThe stopped. -
killed
protected volatile boolean killedThe killed. -
pauseOnException
private boolean pauseOnExceptionThe pause on exception. -
annotatorList
The annotator list. -
annotatorDeployList
The annotator deploy list. -
consumerList
The consumer list. -
consumerDeployList
The consumer deploy list. -
numToProcess
private long numToProcessThe num to process. -
poolSize
private int poolSizeThe pool size. -
procTr
The proc tr. -
stats
The stats. -
statusCbL
The status cb L. -
readerFetchSize
private int readerFetchSizeThe reader fetch size. -
inputQueueSize
private int inputQueueSizeThe input queue size. -
outputQueueSize
private int outputQueueSizeThe output queue size. -
concurrentThreadCount
private int concurrentThreadCountThe concurrent thread count. -
analysisEngines
The analysis engines. -
consumers
The consumers. -
casprocessorList
The casprocessor list. -
producer
The producer. -
producerResult
-
cpeFactory
The cpe factory. -
processingUnits
The processing units. -
processingUnitResults
-
casConsumerPU
The cas consumer PU. -
casConsumerPUResult
-
outputQueue
The output queue. -
workQueue
The work queue. -
checkpointData
The checkpoint data. -
mixedCasProcessorTypeSupport
private boolean mixedCasProcessorTypeSupportThe mixed cas processor type support. -
mPerformanceTuningSettings
The m performance tuning settings. -
dbgCtrlThread
The dbg ctrl thread. -
pca
The pca. -
activeProcessingUnits
private int activeProcessingUnitsThe active processing units. -
hardKill
private boolean hardKillThe hard kill. -
skippedDocs
The skipped docs. -
definedCapabilities
The defined capabilities. -
needsTCas
private boolean needsTCasThe needs T cas. -
crFetchTime
private long crFetchTimeThe cr fetch time. -
readerState
private int readerStateThe reader state. -
dropCasOnExceptionPolicy
private boolean dropCasOnExceptionPolicyThe drop cas on exception policy. -
singleThreadedCPE
private boolean singleThreadedCPEThe single threaded CPE. -
nonThreadedProcessingUnit
The non threaded processing unit. -
nonThreadedCasConsumerProcessingUnit
The non threaded cas consumer processing unit. -
initial_cp_list
The initial cp list. -
casProcessorsDeployed
private boolean casProcessorsDeployedThe cas processors deployed. -
consumerThreadStarted
private boolean consumerThreadStartedThe consumer thread started. -
readerThreadStarted
private boolean readerThreadStartedThe reader thread started. -
processingThreadsState
private int[] processingThreadsStateThe processing threads state.
-
-
Constructor Details
-
CPMEngine
public CPMEngine(CPMExecutorService aExecutorService, CPEFactory aCpeFactory, ProcessTrace aProcTr, CheckpointData aCheckpointData) throws Exception Initializes Collection Processing Engine. Assigns this thread and all processing threads created by this component to a common Thread Group.- Parameters:
aExecutorService- - contains all CPM related threadsaCpeFactory- - CPE factory object responsible for parsing cpe descriptor and creating componentsaProcTr- - instance of the ProcessTrace where the CPM accumulates statsaCheckpointData- - checkpoint object facillitating restart from the last known point- Throws:
Exception- the exception
-
-
Method Details
-
getExecutorService
CPMExecutorService getExecutorService() -
getProcessingContainers
Returns a list of Processing Containers for Analysis Engines. Each CasProcessor is managed by its own container.- Returns:
- the processing containers
-
getAllProcessingContainers
Returns a list of All Processing Containers. Each CasProcessor is managed by its own container.- Returns:
- the all processing containers
-
getThreadCount
Returns number of processing threads.- Returns:
- - number of processing threads
- Throws:
ResourceConfigurationException- -
-
setStats
Plugs in a map where the engine stores perfomance info at runtime.- Parameters:
aMap- - map for runtime stats and totals
-
getStats
Returns CPE stats.- Returns:
- Map containing CPE stats
-
setPauseOnException
public void setPauseOnException(boolean aPause) Sets a global flag to indicate to the CPM that it should pause whenever exception occurs.- Parameters:
aPause- - true if pause is requested on exception, false otherwise
-
isPauseOnException
public boolean isPauseOnException()Returns if the CPM should pause when exception occurs.- Returns:
- - true if the CPM pauses when exception occurs, false otherwise
-
setInputQueueSize
public void setInputQueueSize(int aInputQueueSize) Defines the size of inputQueue. The queue stores this many entities read from the CollectionReader. Every processing pipeline thread will read its entities from this input queue. The CollectionReader is decoupled from the consumer of entities, and continuously replenishes the input queue.- Parameters:
aInputQueueSize- the size of the batch.
-
setOutputQueueSize
public void setOutputQueueSize(int aOutputQueueSize) Defines the size of outputQueue. The queue stores this many entities enqueued by every processing pipeline thread.The results of analysis are dumped into this queue for consumer thread to consume its contents.- Parameters:
aOutputQueueSize- the size of the batch.
-
setPoolSize
public void setPoolSize(int aPoolSize) Defines the size of Cas Pool.- Parameters:
aPoolSize- the size of the Cas pool.
-
getPoolSize
public int getPoolSize()Gets the pool size.- Returns:
- the pool size
-
setConcurrentThreadSize
public void setConcurrentThreadSize(int aConcurrentThreadSize) Defines number of threads executing the processing pipeline concurrently.- Parameters:
aConcurrentThreadSize- the size of the batch.
-
addStatusCallbackListener
Adds the status callback listener.- Parameters:
aListener- the a listener
-
getCallbackListeners
Returns a list of ALL callback listeners currently registered with the CPM.- Returns:
- -
-
removeStatusCallbackListener
Unregisters given listener from the CPM.- Parameters:
aListener- - instance ofBaseStatusCallbackListenerto unregister
-
isKilled
public boolean isKilled()Returns true if this engine has been killed.- Returns:
- true if this engine has been killed
-
dumpState
private void dumpState()Dumps some internal state of the CPE. Used for debugging. -
killIt
public void killIt()Kill CPM the hard way. None of the entities in the queues will be processed. This methof simply empties all queues and at the end adds EOFToken to the work queue so that all threads go away. -
isHardKilled
public boolean isHardKilled()Returns if the CPE was killed hard. Soft kill allows the CPE to finish processing all in-transit CASes. Hard kill causes the CPM to stop processing and to throw away all unprocessed CASes from its queues.- Returns:
- true if the CPE was killed hard
-
asynchStop
Deprecated.Asynch stop. -
stopIt
public void stopIt()Stops execution of the Processing Pipeline and this thread. -
getIndexInList
Returns index to a CasProcessor with a given name in a given List.- Parameters:
aDeployList- - List of CasConsumers to be searchedaName- - name of the CasConsumer we want to find- Returns:
- 0 - if a CasConsumer is not found in a list, else returns a position in the list where the CasConsumer can found
-
getPositionInListIfExists
Find the position in the list of the Cas Processor with a given name.- Parameters:
aName- the a nameaList- the a list- Returns:
- the position in the list of the Cas Processor with a given name
-
isMultipleDeploymentAllowed
private boolean isMultipleDeploymentAllowed(String aDescPath, String aCpName, boolean isConsumer) throws Exception Parses Cas Processor descriptor and checks if it is parallelizable.- Parameters:
aDescPath- - fully qualified path to a CP descriptoraCpName- - name of the CPisConsumer- - true if the CP is a Cas Consumer, false otherwise- Returns:
- - true if CP is parallelizable, false otherwise
- Throws:
Exception- -
-
isParallizable
Determines if a given Cas Processor is parallelizable. Remote Cas Processors are by default parallelizable. For integrated and managed the CPM consults Cas Processor's descriptor to determine if it is parallelizable.- Parameters:
aProcessor- - Cas Processor being checkedaCpName- - name of the CP- Returns:
- - true if CP is parallelizable, false otherwise
- Throws:
Exception- -
-
addCasConsumer
Adds Cas Processor to a single-threaded pipeline. This pipeline is fed by the output queue and typicall contains Cas Consumers. AEs can alos be part of this pipeline.- Parameters:
aProcessor- - Cas Processor to add to single-threaded pipelineaCpName- - name of the Cas Processor- Throws:
Exception- -
-
addParallizableCasProcessor
Add Cas Processor to a list of CPs that are to be run in the parallelizable pipeline. The fact that the CP is in parallelizable pipeline does not mean that there will be instance per pipeline of CP. Its allowed to have a single instance, shareable CP running in multi-threaded pipeline.- Parameters:
aProcessor- - CP to add to parallelizable pipelineaCpName- - name of the CP- Throws:
Exception- -
-
classifyCasProcessors
Classify based on Cas Processor capability to run in parallel. Some Cas Processors need to run as single instance only. It scans the list of Cas Processors backwords and moves those Cas Processors that are not parallelizable to a separate single-thread pipeline. This process of moving CPs continues until the first parallelizable Cas Processor is found. Beyond this all Cas Processors are moved to a parallelizable pipeline. If the non-parallelizable CP is in the parallelizable pipeline there simply will be a single instance of it that will be shared by all processing threads.- Throws:
Exception- -
-
addCasProcessor
Adds a CASProcessor to the processing pipeline. If a CasProcessor already exists and its status=DISABLED this method will re-enable the CasProcesser.- Parameters:
aCasProcessor- CASProcessor to be added to the processing pipeline- Throws:
ResourceConfigurationException- the resource configuration exception
-
addCasProcessor
public void addCasProcessor(CasProcessor aCasProcessor, int aIndex) throws ResourceConfigurationException Adds a CASProcessor to the processing pipeline at a given place in the processing pipeline.- Parameters:
aCasProcessor- CASProcessor to be added to the processing pipelineaIndex- - insertion point for a given CasProcessor- Throws:
ResourceConfigurationException- the resource configuration exception
-
removeCasProcessor
public void removeCasProcessor(int aCasProcessorIndex) Removes a CASProcessor from the processing pipeline.- Parameters:
aCasProcessorIndex- - CasProcessor position in processing pipeline
-
disableCasProcessor
public void disableCasProcessor(int aCasProcessorIndex) Disable a CASProcessor in the processing pipeline.- Parameters:
aCasProcessorIndex- CASProcessor to be added to the processing pipeline
-
disableCasProcessor
Disable a CASProcessor in the processing pipeline.- Parameters:
aCasProcessorName- CASProcessor to be added to the processing pipeline
-
enableCasProcessor
Disable a CASProcessor in the processing pipeline.- Parameters:
aCasProcessorName- CASProcessor to be added to the processing pipeline
-
getCasProcessors
Returns all CASProcesors in the processing pipeline.- Returns:
- the cas processors
-
deployConsumers
Deploys all Cas Consumers.- Throws:
AbortCPMException- -
-
redeployAnalysisEngine
Deploys CasProcessor and associates it with aProcessingContainer.- Parameters:
aProcessingContainer- the a processing container- Throws:
Exception- the exception
-
deployAnalysisEngines
Deploys All Analysis Engines. Analysis Engines run in a replicated processing units seperate from Cas Consumers.- Throws:
AbortCPMException- -
-
deployCasProcessors
Starts CASProcessor containers one a time. During this phase the container deploys a TAE as local,remote, or integrated CasProcessor.- Throws:
AbortCPMException- the abort CPM exception
-
restoreFromCheckpoint
Restores named events from the checkpoint.- Parameters:
component- - component name to restore named event foraEvType- - event to restore
-
copyComponentEvents
Copy given component events.- Parameters:
aEvType- - event typeaList- - list of events to copyaPTr- -- Throws:
IOException- -
-
isRunning
public boolean isRunning()Returns a global flag indicating if this Thread is in processing state.- Returns:
- true, if is running
-
isPaused
public boolean isPaused()Returns a global flag indicating if this Thread is in pause state.- Returns:
- true, if is paused
-
pauseIt
public void pauseIt()Pauses this thread. -
resumeIt
public void resumeIt()Resumes this thread. -
setCollectionReader
Sets CollectionReader to use during processing.- Parameters:
aCollectionReader- aCollectionReader
-
setNumToProcess
public void setNumToProcess(long aNumToProcess) Defines the size of the batch.- Parameters:
aNumToProcess- the new num to process
-
getLastProcessedDocId
Returns Id of the last document processed.- Returns:
- the last processed doc id
-
getLastDocRepository
Gets the last doc repository.- Returns:
- the last doc repository
-
producePU
Instantiate custom Processing Pipeline.- Parameters:
aClassName- - name of a class that extends ProcessingUnit- Returns:
- - an instance of the ProcessingUnit
- Throws:
Exception- -
-
startDebugControlThread
private void startDebugControlThread()Start debug control thread. -
createOutputQueue
Instantiate custom Output Queue.- Parameters:
aQueueSize- - max size of the queue- Returns:
- - new instance of the output queue
- Throws:
Exception- -
-
notifyListenersWithException
Notify listeners of a given exception.- Parameters:
e- - en exception to be sent to listeners
-
pipelineKilled
Callback method used to notify the engine when a processing pipeline is killed due to excessive errors. This method is only called if the processing pipeline is unable to acquire a connection to remote service and when configuration indicates 'kill-pipeline' as the action to take on excessive errors. When running with multiple pipelines, routine decrements a global pipeline counter and tests if there are no more left. When all pipelines are killed as described above, the CPM needs to terminate. Since pipelines are prematurely killed, there are artifacts (CASes) in the work queue. These must be removed from the work queue and disposed of (released) back to the CAS pool so that the Collection Reader thread properly exits.- Parameters:
aPipelineThreadName- - name of the pipeline thread exiting from its run() method
-
run
public void run()Using given configuration creates and starts CPE processing pipeline. It is either single-threaded or a multi-threaded pipeline. Which is actually used depends on the configuration defined in the CPE descriptor. In multi-threaded mode, the CPE starts number of threads: 1) ArtifactProducer Thread - this is a thread containing a Collection Reader. It runs asynchronously and it fills a WorkQueue with CASes. 2) CasConsumer Thread - this is an optional thread. It is only instantiated if there Cas Consumers in the pipeline 3) Processing Threads - one or more processing threads, configured identically, that are performing analysis How many threads are started depends on configuration in CPE descriptor All threads started here are placed in a ThreadGroup. This provides a catch-all mechanism for errors that may occur in the CPM. If error is thrown, the ThreadGroup is notified. The ThreadGroup than notifies all registers listeners to give an application a chance to report the error and do necessary cleanup. This routine manages all the threads and makes sure that all of them are cleaned up before returning. The ThreadGroup must cleanup all threads under its control otherwise a memory leak occurs. Even those threads that are not started must be cleaned as they end up in the ThreadGroup when instantiated. The code uses number of state variables to make decisions during cleanup. -
forcePUShutdown
private void forcePUShutdown()Place EOF Token onto a work queue to force thread exit. -
getTimer
Return timer to measure performace of the cpm. The timer can optionally be configured in the CPE descriptor. If none defined, the method returns default timer.- Returns:
- - customer timer or JavaTimer (default)
- Throws:
Exception- -
-
cleanup
public void cleanup()Null out fields of this object. Call this only when this object is no longer needed. -
registerTypeSystemsWithCasManager
Registers Type Systems of all components with the CasManager.- Throws:
Exception- the exception
-
callTypeSystemInit
Call typeSystemInit method on each component.- Throws:
ResourceInitializationException- the resource initialization exception
-
stopCasProcessors
Stops All Cas Processors and optionally changes the status according to kill flag.- Parameters:
kill- - true if CPE has been stopped before completing normally- Throws:
CasProcessorDeploymentException- the cas processor deployment exception
-
getProgress
Returns collectionReader progress.- Returns:
- the progress
-
getStatForContainer
Gets the stat for container.- Parameters:
aContainer- the a container- Returns:
- the stat for container
-
saveStat
Save stat.- Parameters:
aStatLabel- the a stat labelaStatValue- the a stat valueaContainer- the a container
-
isProcessorReady
private boolean isProcessorReady(int aStatus) Check if the CASProcessor status is available for processing.- Parameters:
aStatus- the a status- Returns:
- true, if is processor ready
-
invalidateCASes
Invalidate CA ses.- Parameters:
aCASList- the a CAS list
-
releaseCASes
Releases given cases back to pool.- Parameters:
aCASList- - cas list to release
-
setPerformanceTuningSettings
Overrides the default performance tuning settings for this CPE. This affects things such as CAS sizing parameters.- Parameters:
aPerformanceTuningSettings- the new settings- See Also:
-
getPerformanceTuningSettings
Gets the performance tuning settings.- Returns:
- Returns the PerformanceTuningSettings.
-
setProcessControllerAdapter
Sets the process controller adapter.- Parameters:
aPca- the new process controller adapter
-
getCpeConfig
Gets the cpe config.- Returns:
- the cpe config
- Throws:
Exception- the exception
-
processingUnitShutdown
Called from the ProcessingUnits when they shutdown due to having received the EOFToken. When all ProcessingUnits have shut down, we put an EOFToken on the output queue so that The CAS Consumers will also shut down. -Adam- Parameters:
unit- the unit
-
dropCasOnException
public boolean dropCasOnException()Drop cas on exception.- Returns:
- true, if successful
-
getCasWithSOFA
Gets the cas with SOFA.- Parameters:
entity- the entitypTrTemp- the tr temp- Returns:
- the cas with SOFA
-
needsView
private boolean needsView()Needs view.- Returns:
- true if needsTCas
-
bootstrapCPE
Initialize the CPE.- Throws:
Exception- -
-
setupProcessingPipeline
Setup single threaded pipeline.- Throws:
Exception- -
-
setupConsumerPipeline
Setup Cas Consumer pipeline as single threaded.- Throws:
Exception- -
-
skipDroppedDocument
Determines if a given CAS should be skipped.- Parameters:
entity- - container for CAS- Returns:
- true if a given CAS should be skipped
-
runSingleThreaded
Runs the CPE in a single thread without queues.- Throws:
Exception- -
-
endOfProcessingReached
private boolean endOfProcessingReached(long entityCount) Determines if the CPM processed all documents.- Parameters:
entityCount- - number of documents processed so far- Returns:
- true if all documents processed, false otherwise
-
handleException
Handle given exception.- Parameters:
t- - exception to handleentity- - CAS containeraPTrace- - process trace
-
notifyListeners
Notify listeners.- Parameters:
aMsgType- the a msg typeentity- the entityaPTrace- the a P trace
-
notifyListeners
Notify listeners.- Parameters:
aMsgType- the a msg typeentity- the entityaPTrace- the a P tracet- the t
-
callEntityProcessCompleteWithCAS
public static void callEntityProcessCompleteWithCAS(StatusCallbackListener statCL, CAS cas, EntityProcessStatus eps) Internal use only, public for cross package access. switches class loaders and locks cas- Parameters:
statCL- status call back listenercas- CASeps- entity process status
-
getProcessTrace
Gets the process trace.- Returns:
- the process trace
- Throws:
Exception- the exception
-
tearDownCPE
private void tearDownCPE()Stop and cleanup single-threaded CPE. -
waitForCpmToResumeIfPaused
private void waitForCpmToResumeIfPaused()Wait for CPM to resume if paused.
-