public class CPMEngine extends Thread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
CPECasPool |
casPool |
protected boolean |
isRunning |
protected boolean |
killed |
Object |
lockForPause |
protected BoundedWorkQueue |
outputQueue |
protected boolean |
pause |
protected ProcessingUnit[] |
processingUnits |
protected boolean |
stopped |
protected BoundedWorkQueue |
workQueue |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
CPMEngine(CPMThreadGroup aThreadGroup,
CPEFactory aCpeFactory,
ProcessTrace aProcTr,
CheckpointData aCheckpointData)
Initializes Collection Processing Engine.
|
Modifier and Type | Method and Description |
---|---|
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(String aCasProcessorName)
Disable a CASProcessor in the processing pipeline
|
boolean |
dropCasOnException() |
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
|
CasProcessor[] |
getCasProcessors()
Returns all CASProcesors in the processing pipeline
|
protected CpeConfiguration |
getCpeConfig() |
String |
getLastDocRepository() |
String |
getLastProcessedDocId()
Returns Id of the last document processed
|
Properties |
getPerformanceTuningSettings() |
int |
getPoolSize() |
LinkedList |
getProcessingContainers()
Returns a list of Processing Containers for Analysis Engines.
|
Progress[] |
getProgress()
Returns collectionReader progress.
|
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,
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(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(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(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, yield
public 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, 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
public LinkedList getProcessingContainers()
public LinkedList getAllProcessingContainers()
public int getThreadCount() throws ResourceConfigurationException
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(BaseStatusCallbackListener aListener)
public 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, String aCpName) throws Exception
aProcessor
- -
Cas Processor being checkedaCpName
- -
name of the CPException
- -public void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException
aCasProcessor
- CASProcessor to be added to the processing pipelineResourceConfigurationException
public void addCasProcessor(CasProcessor aCasProcessor, int aIndex) throws ResourceConfigurationException
aCasProcessor
- CASProcessor to be added to the processing pipelineaIndex
- -
insertion point for a given CasProcessorResourceConfigurationException
public 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 CasProcessor[] getCasProcessors()
public void redeployAnalysisEngine(ProcessingContainer aProcessingContainer) throws Exception
ProcessingContainer
aProcessingContainer
- Exception
public void deployCasProcessors() throws AbortCPMException
AbortCPMException
public boolean isRunning()
public boolean isPaused()
public void pauseIt()
public void resumeIt()
public void setCollectionReader(BaseCollectionReader aCollectionReader)
aCollectionReader
- aCollectionReaderpublic void setNumToProcess(long aNumToProcess)
public 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
public Progress[] getProgress()
public void invalidateCASes(CAS[] aCASList)
public void releaseCASes(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
- protected CpeConfiguration getCpeConfig() throws Exception
Exception
public boolean dropCasOnException()
public void runSingleThreaded() throws Exception
Exception
- -public static void callEntityProcessCompleteWithCAS(StatusCallbackListener statCL, CAS cas, EntityProcessStatus eps)
statCL
- status call back listenercas
- caseps
- entity process statusCopyright © 2006–2015 The Apache Software Foundation. All rights reserved.