public class CPMEngine extends Thread
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
CPECasPool |
casPool
The cas pool.
|
protected boolean |
isRunning
The is running.
|
protected boolean |
killed
The killed.
|
Object |
lockForPause
The lock for pause.
|
protected BoundedWorkQueue |
outputQueue
The output queue.
|
protected boolean |
pause
The pause.
|
protected ProcessingUnit[] |
processingUnits
The processing units.
|
protected boolean |
stopped
The stopped.
|
protected BoundedWorkQueue |
workQueue
The work queue.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
CPMEngine(CPMThreadGroup aThreadGroup,
CPEFactory aCpeFactory,
org.apache.uima.util.ProcessTrace aProcTr,
CheckpointData aCheckpointData)
Initializes Collection Processing Engine.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor aCasProcessor)
Adds a CASProcessor to the processing pipeline.
|
void |
addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor aCasProcessor,
int aIndex)
Adds a CASProcessor to the processing pipeline at a given place in the processing pipeline.
|
void |
addStatusCallbackListener(org.apache.uima.collection.base_cpm.BaseStatusCallbackListener aListener)
Adds the status callback listener.
|
void |
asynchStop()
Deprecated.
|
static void |
callEntityProcessCompleteWithCAS(org.apache.uima.collection.StatusCallbackListener statCL,
org.apache.uima.cas.CAS cas,
org.apache.uima.collection.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(String aCasProcessorName)
Disable a CASProcessor in the processing pipeline.
|
boolean |
dropCasOnException()
Drop cas on exception.
|
void |
enableCasProcessor(String aCasProcessorName)
Disable a CASProcessor in the processing pipeline.
|
LinkedList |
getAllProcessingContainers()
Returns a list of All Processing Containers.
|
ArrayList |
getCallbackListeners()
Returns a list of ALL callback listeners currently registered with the CPM.
|
org.apache.uima.collection.base_cpm.CasProcessor[] |
getCasProcessors()
Returns all CASProcesors in the processing pipeline.
|
protected org.apache.uima.collection.metadata.CpeConfiguration |
getCpeConfig()
Gets the cpe config.
|
String |
getLastDocRepository()
Gets the last doc repository.
|
String |
getLastProcessedDocId()
Returns Id of the last document processed.
|
Properties |
getPerformanceTuningSettings()
Gets the performance tuning settings.
|
int |
getPoolSize()
Gets the pool size.
|
LinkedList |
getProcessingContainers()
Returns a list of Processing Containers for Analysis Engines.
|
org.apache.uima.util.Progress[] |
getProgress()
Returns collectionReader progress.
|
Map |
getStats()
Returns CPE stats.
|
int |
getThreadCount()
Returns number of processing threads.
|
void |
invalidateCASes(org.apache.uima.cas.CAS[] aCASList)
Invalidate CA ses.
|
boolean |
isHardKilled()
Returns if the CPE was killed hard.
|
boolean |
isKilled()
Returns true if this engine has been killed.
|
boolean |
isParallizable(org.apache.uima.collection.base_cpm.CasProcessor aProcessor,
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(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(org.apache.uima.cas.CAS[] aCASList)
Releases given cases back to pool.
|
void |
removeCasProcessor(int aCasProcessorIndex)
Removes a CASProcessor from the processing pipeline.
|
void |
removeStatusCallbackListener(org.apache.uima.collection.base_cpm.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(org.apache.uima.collection.base_cpm.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(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)
Sets the process controller adapter.
|
void |
setStats(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.
|
activeCount, checkAccess, clone, 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, yieldpublic CPECasPool casPool
public final 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
public CPMEngine(CPMThreadGroup aThreadGroup, CPEFactory aCpeFactory, org.apache.uima.util.ProcessTrace aProcTr, CheckpointData aCheckpointData) throws 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 pointException - the exceptionpublic LinkedList getProcessingContainers()
public LinkedList getAllProcessingContainers()
public int getThreadCount()
throws org.apache.uima.resource.ResourceConfigurationException
org.apache.uima.resource.ResourceConfigurationException - -public void setStats(Map aMap)
aMap - -
map for runtime stats and totalspublic Map getStats()
public void setPauseOnException(boolean aPause)
aPause - -
true if pause is requested on exception, false otherwisepublic boolean isPauseOnException()
public void setInputQueueSize(int aInputQueueSize)
aInputQueueSize - the size of the batch.public void setOutputQueueSize(int aOutputQueueSize)
aOutputQueueSize - 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)
aConcurrentThreadSize - the size of the batch.public void addStatusCallbackListener(org.apache.uima.collection.base_cpm.BaseStatusCallbackListener aListener)
aListener - the a listenerpublic ArrayList getCallbackListeners()
public void removeStatusCallbackListener(org.apache.uima.collection.base_cpm.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(org.apache.uima.collection.base_cpm.CasProcessor aProcessor,
String aCpName)
throws Exception
aProcessor - -
Cas Processor being checkedaCpName - -
name of the CPException - -public void addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor aCasProcessor)
throws org.apache.uima.resource.ResourceConfigurationException
aCasProcessor - CASProcessor to be added to the processing pipelineorg.apache.uima.resource.ResourceConfigurationException - the resource configuration exceptionpublic void addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor aCasProcessor,
int aIndex)
throws org.apache.uima.resource.ResourceConfigurationException
aCasProcessor - CASProcessor to be added to the processing pipelineaIndex - -
insertion point for a given CasProcessororg.apache.uima.resource.ResourceConfigurationException - the resource configuration exceptionpublic void removeCasProcessor(int aCasProcessorIndex)
aCasProcessorIndex - -
CasProcessor position in processing pipelinepublic void disableCasProcessor(int aCasProcessorIndex)
aCasProcessorIndex - CASProcessor to be added to the processing pipelinepublic void disableCasProcessor(String aCasProcessorName)
aCasProcessorName - CASProcessor to be added to the processing pipelinepublic void enableCasProcessor(String aCasProcessorName)
aCasProcessorName - CASProcessor to be added to the processing pipelinepublic org.apache.uima.collection.base_cpm.CasProcessor[] getCasProcessors()
public void redeployAnalysisEngine(ProcessingContainer aProcessingContainer) throws Exception
ProcessingContainer.aProcessingContainer - the a processing containerException - the exceptionpublic void deployCasProcessors()
throws org.apache.uima.collection.base_cpm.AbortCPMException
org.apache.uima.collection.base_cpm.AbortCPMException - the abort CPM exceptionpublic boolean isRunning()
public boolean isPaused()
public void pauseIt()
public void resumeIt()
public void setCollectionReader(org.apache.uima.collection.base_cpm.BaseCollectionReader aCollectionReader)
aCollectionReader - aCollectionReaderpublic void setNumToProcess(long aNumToProcess)
aNumToProcess - the new num to processpublic String getLastProcessedDocId()
public String getLastDocRepository()
public void pipelineKilled(String aPipelineThreadName)
aPipelineThreadName - -
name of the pipeline thread exiting from its run() methodpublic void run()
public void cleanup()
public void stopCasProcessors(boolean kill)
throws CasProcessorDeploymentException
kill - - true if CPE has been stopped before completing normallyCasProcessorDeploymentException - the cas processor deployment exceptionpublic org.apache.uima.util.Progress[] getProgress()
public void invalidateCASes(org.apache.uima.cas.CAS[] aCASList)
aCASList - the a CAS listpublic void releaseCASes(org.apache.uima.cas.CAS[] aCASList)
aCASList - -
cas list to releasepublic void setPerformanceTuningSettings(Properties aPerformanceTuningSettings)
aPerformanceTuningSettings - the new settingsUIMAFramework.getDefaultPerformanceTuningProperties()public Properties getPerformanceTuningSettings()
public void setProcessControllerAdapter(ProcessControllerAdapter aPca)
aPca - the new process controller adapterprotected org.apache.uima.collection.metadata.CpeConfiguration getCpeConfig()
throws Exception
Exception - the exceptionpublic boolean dropCasOnException()
public void runSingleThreaded()
throws Exception
Exception - -public static void callEntityProcessCompleteWithCAS(org.apache.uima.collection.StatusCallbackListener statCL,
org.apache.uima.cas.CAS cas,
org.apache.uima.collection.EntityProcessStatus eps)
statCL - status call back listenercas - caseps - entity process statusCopyright © 2006–2017 The Apache Software Foundation. All rights reserved.