|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.apache.uima.collection.impl.cpm.engine.CPMEngine
public class CPMEngine
Responsible for creating and initializing processing threads. This instance manages the lifecycle of the CPE components. It exposes API for plugging in components programmatically instead of declaratively. Running in its own thread, this components creates seperate 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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
CPECasPool |
casPool
|
protected boolean |
isRunning
|
protected boolean |
killed
|
java.lang.Object |
lockForPause
|
protected BoundedWorkQueue |
outputQueue
|
protected boolean |
pause
|
protected ProcessingUnit[] |
processingUnits
|
protected boolean |
stopped
|
protected BoundedWorkQueue |
workQueue
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
CPMEngine(CPMThreadGroup aThreadGroup,
CPEFactory aCpeFactory,
ProcessTrace aProcTr,
CheckpointData aCheckpointData)
Initializes Collection Processing Engine. |
Method Summary | |
---|---|
void |
addCasProcessor(CasProcessor aCasProcessor)
Adds a CASProcessor to the processing pipeline. |
void |
addCasProcessor(CasProcessor aCasProcessor,
int aIndex)
Adds a CASProcessor to the processing pipeline at a given place in the processing pipeline |
void |
addStatusCallbackListener(BaseStatusCallbackListener aListener)
|
void |
asynchStop()
Deprecated. |
static void |
callEntityProcessCompleteWithCAS(StatusCallbackListener statCL,
CAS cas,
EntityProcessStatus eps)
Internal use only, public for crss package access. |
void |
cleanup()
Null out fields of this object. |
void |
deployCasProcessors()
Starts CASProcessor containers one a time. |
void |
disableCasProcessor(int aCasProcessorIndex)
Disable a CASProcessor in the processing pipeline |
void |
disableCasProcessor(java.lang.String aCasProcessorName)
Disable a CASProcessor in the processing pipeline |
boolean |
dropCasOnException()
|
void |
enableCasProcessor(java.lang.String aCasProcessorName)
Disable a CASProcessor in the processing pipeline |
java.util.LinkedList |
getAllProcessingContainers()
Returns a list of All Processing Containers. |
java.util.ArrayList |
getCallbackListeners()
Returns a list of ALL callback listeners currently registered with the CPM |
CasProcessor[] |
getCasProcessors()
Returns all CASProcesors in the processing pipeline |
protected CpeConfiguration |
getCpeConfig()
|
java.lang.String |
getLastDocRepository()
|
java.lang.String |
getLastProcessedDocId()
Returns Id of the last document processed |
java.util.Properties |
getPerformanceTuningSettings()
|
int |
getPoolSize()
|
java.util.LinkedList |
getProcessingContainers()
Returns a list of Processing Containers for Analysis Engines. |
Progress[] |
getProgress()
Returns collectionReader progress. |
java.util.Map |
getStats()
Returns CPE stats |
int |
getThreadCount()
Returns number of processing threads |
void |
invalidateCASes(CAS[] aCASList)
|
boolean |
isHardKilled()
Returns if the CPE was killed hard. |
boolean |
isKilled()
Returns true if this engine has been killed |
boolean |
isParallizable(CasProcessor aProcessor,
java.lang.String aCpName)
Determines if a given Cas Processor is parallelizable. |
boolean |
isPaused()
Returns a global flag indicating if this Thread is in pause state |
boolean |
isPauseOnException()
Returns if the CPM should pause when exception occurs |
boolean |
isRunning()
Returns a global flag indicating if this Thread is in processing state |
void |
killIt()
Kill CPM the hard way. |
void |
pauseIt()
Pauses this thread |
void |
pipelineKilled(java.lang.String aPipelineThreadName)
Callback method used to notify the engine when a processing pipeline is killed due to excessive errors. |
void |
redeployAnalysisEngine(ProcessingContainer aProcessingContainer)
Deploys CasProcessor and associates it with a ProcessingContainer |
void |
releaseCASes(CAS[] aCASList)
Releases given cases back to pool. |
void |
removeCasProcessor(int aCasProcessorIndex)
Removes a CASProcessor from the processing pipeline |
void |
removeStatusCallbackListener(BaseStatusCallbackListener aListener)
Unregisters given listener from the CPM |
void |
resumeIt()
Resumes this thread |
void |
run()
Using given configuration creates and starts CPE processing pipeline. |
void |
runSingleThreaded()
Runs the CPE in a single thread without queues. |
void |
setCollectionReader(BaseCollectionReader aCollectionReader)
Sets CollectionReader to use during processing |
void |
setConcurrentThreadSize(int aConcurrentThreadSize)
Defines number of threads executing the processing pipeline concurrently. |
void |
setInputQueueSize(int aInputQueueSize)
Defines the size of inputQueue. |
void |
setNumToProcess(long aNumToProcess)
Defines the size of the batch |
void |
setOutputQueueSize(int aOutputQueueSize)
Defines the size of outputQueue. |
void |
setPauseOnException(boolean aPause)
Sets a global flag to indicate to the CPM that it should pause whenever exception occurs |
void |
setPerformanceTuningSettings(java.util.Properties aPerformanceTuningSettings)
Overrides the default performance tuning settings for this CPE. |
void |
setPoolSize(int aPoolSize)
Defines the size of Cas Pool. |
void |
setProcessControllerAdapter(ProcessControllerAdapter aPca)
|
void |
setStats(java.util.Map aMap)
Plugs in a map where the engine stores perfomance info at runtime |
void |
stopCasProcessors(boolean kill)
Stops All Cas Processors and optionally changes the status according to kill flag |
void |
stopIt()
Stops execution of the Processing Pipeline and this thread. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public CPECasPool casPool
public final java.lang.Object lockForPause
protected boolean pause
protected volatile boolean isRunning
protected volatile boolean stopped
protected volatile boolean killed
protected ProcessingUnit[] processingUnits
protected BoundedWorkQueue outputQueue
protected BoundedWorkQueue workQueue
Constructor Detail |
---|
public CPMEngine(CPMThreadGroup aThreadGroup, CPEFactory aCpeFactory, ProcessTrace aProcTr, CheckpointData aCheckpointData) throws java.lang.Exception
aThreadGroup
- -
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
java.lang.Exception
Method Detail |
---|
public java.util.LinkedList getProcessingContainers()
public java.util.LinkedList getAllProcessingContainers()
public int getThreadCount() throws ResourceConfigurationException
ResourceConfigurationException
public void setStats(java.util.Map aMap)
aMap
- -
map for runtime stats and totalspublic java.util.Map getStats()
public void setPauseOnException(boolean aPause)
aPause
- -
true if pause is requested on exception, false otherwisepublic boolean isPauseOnException()
public void setInputQueueSize(int aInputQueueSize)
aBatchSize
- the size of the batch.public void setOutputQueueSize(int aOutputQueueSize)
aBatchSize
- the size of the batch.public void setPoolSize(int aPoolSize)
aPoolSize
- the size of the Cas pool.public int getPoolSize()
public void setConcurrentThreadSize(int aConcurrentThreadSize)
aBatchSize
- the size of the batch.public void addStatusCallbackListener(BaseStatusCallbackListener aListener)
public java.util.ArrayList getCallbackListeners()
public void removeStatusCallbackListener(BaseStatusCallbackListener aListener)
aListener
- -
instance of BaseStatusCallbackListener
to unregisterpublic boolean isKilled()
public void killIt()
public boolean isHardKilled()
@Deprecated public void asynchStop()
public void stopIt()
public boolean isParallizable(CasProcessor aProcessor, java.lang.String aCpName) throws java.lang.Exception
aProcessor
- -
Cas Processor being checkedaCpName
- -
name of the CP
java.lang.Exception
public void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException
aProcessor
- CASProcessor to be added to the processing pipeline
ResourceConfigurationException
public void addCasProcessor(CasProcessor aCasProcessor, int aIndex) throws ResourceConfigurationException
aProcessor
- CASProcessor to be added to the processing pipelineaIndex
- -
insertion point for a given CasProcessor
ResourceConfigurationException
public void removeCasProcessor(int aCasProcessorIndex)
aCasProcessorIndex
- -
CasProcessor position in processing pipelinepublic void disableCasProcessor(int aCasProcessorIndex)
aProcessor
- CASProcessor to be added to the processing pipelinepublic void disableCasProcessor(java.lang.String aCasProcessorName)
aProcessor
- CASProcessor to be added to the processing pipelinepublic void enableCasProcessor(java.lang.String aCasProcessorName)
aProcessor
- CASProcessor to be added to the processing pipelinepublic CasProcessor[] getCasProcessors()
public void redeployAnalysisEngine(ProcessingContainer aProcessingContainer) throws java.lang.Exception
ProcessingContainer
aProcessingContainer
-
java.lang.Exception
public void deployCasProcessors() throws AbortCPMException
AbortCPMException
public boolean isRunning()
public boolean isPaused()
public void pauseIt()
public void resumeIt()
public void setCollectionReader(BaseCollectionReader aCollectionReader)
BaseCollectionReader
- aCollectionReaderpublic void setNumToProcess(long aNumToProcess)
public java.lang.String getLastProcessedDocId()
public java.lang.String getLastDocRepository()
public void pipelineKilled(java.lang.String aPipelineThreadName)
aPipelineThreadName
- -
name of the pipeline thread exiting from its run() methodpublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void cleanup()
public void stopCasProcessors(boolean kill) throws CasProcessorDeploymentException
-
- kill - true if CPE has been stopped before completing normally
CasProcessorDeploymentException
public Progress[] getProgress()
public void invalidateCASes(CAS[] aCASList)
public void releaseCASes(CAS[] aCASList)
aCASList
- -
cas list to releasepublic void setPerformanceTuningSettings(java.util.Properties aPerformanceTuningSettings)
aPerformanceTuningSettings
- the new settingsUIMAFramework#getDefaultPerformanceTuningSettings()
public java.util.Properties getPerformanceTuningSettings()
public void setProcessControllerAdapter(ProcessControllerAdapter aPca)
aPca
- protected CpeConfiguration getCpeConfig() throws java.lang.Exception
java.lang.Exception
public boolean dropCasOnException()
public void runSingleThreaded() throws java.lang.Exception
java.lang.Exception
public static void callEntityProcessCompleteWithCAS(StatusCallbackListener statCL, CAS cas, EntityProcessStatus eps)
statCL
- status call back listenercas
- caseps
- entity process status
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |