Class ProcessingContainer_Impl
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer
-
- org.apache.uima.collection.impl.cpm.container.ProcessingContainer_Impl
-
- All Implemented Interfaces:
java.lang.Runnable,CasProcessorController,RunnableContainer,ConfigurableResource,Resource
public class ProcessingContainer_Impl extends ProcessingContainer implements RunnableContainer
Manages a pool of CasProcessor instances. Provides access to CasProcessor instance to Processing Thread. Processing threads check out an instance of Cas Processor and when done invoking its process() method return it back to pool. The container aggregates counts and totals on behalf of all instances of Cas Processor. It also manages error and restart thresholds for Cas Processors as a group. Errors are aggregated for all instances of Cas Processor as a group NOT individually. The container takes appropriate actions when threshold are exceeded. What action is taken depends on declaritive specification in the cpe descriptor.
-
-
Field Summary
Fields Modifier and Type Field Description private intabortCountThe abort count.private longbatchCounterThe batch counter.private intbatchSizeThe batch size.private longbytesInThe bytes in.private longbytesOutThe bytes out.private CasProcessorDeployercasPDeployerThe cas P deployer.private CasProcessorConfigurationcasProcessorCPEConfigurationThe cas processor CPE configuration.ServiceProxyPoolcasProcessorPoolThe cas processor pool.private intcasProcessorStatusThe cas processor status.private ConfigurationParameterSettingsconfigParamsThe config params.private intconfiguredErrorRateThe configured error rate.private static intCONTAINER_SLEEP_TIMEThe Constant CONTAINER_SLEEP_TIME.private interrorCounterThe error counter.java.util.LinkedListfailedCasProcessorListThe failed cas processor list.private longfailureThresholdSampleThe failure threshold sample.private longfetchTimeThe fetch time.private intfilteredCountThe filtered count.private java.util.LinkedListfilterListThe filter list.private booleaninitializedThe initialized.private booleanisIntegratedThe is integrated.private booleanisLocalThe is local.private booleanisPausedThe is paused.private booleanisRemoteThe is remote.private java.lang.ObjectlastCasThe last cas.private java.lang.ObjectlockForIsPausedThe lock for is paused.private java.util.logging.LoggerloggerThe logger.private java.lang.StringlogPathThe log path.private ProcessingResourceMetaDatametadataThe metadata.private longprocessedThe processed.private java.util.StackprocessedEntityIdsThe processed entity ids.private java.lang.StringprocessorNameThe processor name.private longremainingThe remaining.private intrestartCountThe restart count.private intretryCountThe retry count.private longsampleCounterThe sample counter.private booleansingleFencedInstanceThe single fenced instance.private java.util.HashMapstatMapThe stat map.private longtotalTimeThe total time.-
Fields inherited from interface org.apache.uima.collection.impl.base_cpm.container.CasProcessorController
DISABLED, INITIALIZED, KILLED, NOTINITIALIZED, RUNNING
-
Fields inherited from interface org.apache.uima.resource.Resource
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_EXTERNAL_OVERRIDE_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT
-
-
Constructor Summary
Constructors Constructor Description ProcessingContainer_Impl(CasProcessorConfiguration aCasProcessorConfig, ProcessingResourceMetaData aMetaData, ServiceProxyPool aCasProcessorPool)Initialize container with CasProcessor configuration and pool containing instances of CasProcessor instances.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanabortCPMOnError()Returns true if maximum threshold for errors has been exceeded and the CasProcessor is configured to force CPE shutdown.voidaddBytesIn(long aBytesIn)Aggregate total bytes ingested by the CasProcessor.voidaddBytesOut(long aBytesOut)Aggregate total bytes processed by this CasProcessor.voidaddStat(java.lang.String aStatName, java.lang.Object aStat)Add an arbitrary object and bind it to a given name.private booleancontinueOnError()Returns true if the CasProcessor has been configured to continue despite error.private voiddeployLogger()Deploy Container specific logger to capture any exceptions occuring during CasProcessor(s) lifespan.voiddestroy()Destroy instances of CasProcessors managed by this container.intgetAbortCount()Return the up todate number of aborts recorded by the container.java.util.HashMapgetAllStats()Returns all stats aggregate during the CPM run.longgetBytesIn()Returns total number of bytes ingested so far by all CasProcessor instances managed by this container.longgetBytesOut()Returns total number of bytes processed so far by all CasProcessor instances managed by this container.CasProcessorgetCasProcessor()Returns available instance of the CasProcessor from the instance pool.CasProcessorConfigurationgetCasProcessorConfiguration()Returns CasProcessor configuration object.java.lang.ObjectgetConfigParameterValue(java.lang.String aParamName)Looks up the value of a configuration parameter.java.lang.ObjectgetConfigParameterValue(java.lang.String aGroupName, java.lang.String aParamName)Looks up the value of a configuration parameter in a group.CasProcessorDeployergetDeployer()Returns deployer object used to launch the CasProcessor.longgetFetchTime()Gets the fetch time.intgetFilteredCount()Returns number of filtered Cas'es.java.lang.ObjectgetLastCas()Deprecated.java.lang.StringgetLastProcessedEntityId()Returns id of the last entity processed by the CasProcessor.ProcessingResourceMetaDatagetMetadata()Returns component's input/output capabilities.ResourceMetaDatagetMetaData()Gets the metadata that describes thisResource.java.lang.StringgetName()Returns the name of this container.ServiceProxyPoolgetPool()longgetProcessed()Returns number of entities processed so far.longgetRemaining()Returns number of entities still to be processed by the CasProcessor It is a delta of total number of entities to be processed by the CPE minus number of entities processed so far.intgetRestartCount()Returns total number of all CasProcessor restarts.intgetRetryCount()Return the up todate number of retries recorded by the container.java.lang.ObjectgetStat(java.lang.String aStatName)Return an abject identified with a given name.intgetStatus()Returns the current status of the CasProcessor.longgetTotalTime()Returns total time spent in process().private booleanhasFeature(CasData aCas)Used during filtering, determines if a given Cas has a required feature.voidincrementAbortCount(int aCount)Increment number of aborted Cas'es due to inability to process the Cas.voidincrementCasProcessorErrors(java.lang.Throwable aThrowable)This routine determines what to do with an exception thrown during the CasProcessor processing.voidincrementFilteredCount(int aCount)Increments number of CAS'es filtered by the CasProcessor.voidincrementProcessed(int aIncrement)Increment processed.voidincrementRestartCount(int aCount)Increment number of times the casProcessor was restarted due to failures.voidincrementRetryCount(int aCount)Increments number of times CasProceesor failed analyzing Cas'es due to timeout or some other problems.voidincrementStat(java.lang.String aStatName, java.lang.Integer aStat)Increment a value of a given stat.voidincrementTotalTime(long aTime)Increments total time spend in the process() method of the CasProcessor.booleaninitialize(ResourceSpecifier aSpecifier, java.util.Map aAdditionalParams)Initializes thisResourcefrom aResourceSpecifier.booleanisAbortable()Determines if instances of CasProcessor managed by this container are abortable.booleanisEndOfBatch(CasProcessor aCasProcessor, int aProcessedSize)booleanisIntegrated()Deprecated.booleanisLocal()Deprecated.booleanisPaused()booleanisRemote()Deprecated.booleanisSingleFencedService()private booleanisTimeout(java.lang.Throwable aThrowable)Returns true if the Exception cause is SocketTimeoutException.voidlogAbortedCases(java.lang.Object[] abortedCasList)Logs Cas'es that could not be processed.voidpause()Pauses the container until resumed.private booleanprocessCas(java.lang.Object aCas)Checks if a given Cas has required features.booleanprocessCas(java.lang.Object[] aCasList)Returns true if the Cas bundles should be processed by the CasProcessor.voidreconfigure()Instructs this Resource to re-read its configuration parameter settings.voidreleaseCasProcessor(CasProcessor aCasProcessor)Returns a given casProcessor instance back to the pool.private voidresetBatchCounter()Resets batch counter.private voidresetErrorCounter()Re-initializes the error counter.voidresetRestartCount()private voidresetSampleCounter()Resets sample counter.voidresume()voidrun()voidsetCasProcessorDeployer(CasProcessorDeployer aDeployer)Plug in deployer object used to launch/deploy the CasProcessor instance.voidsetConfigParameterValue(java.lang.String aParamName, java.lang.Object aValue)Sets the value of a configuration parameter.voidsetConfigParameterValue(java.lang.String aGroupName, java.lang.String aParamName, java.lang.Object aValue)Sets the value of a configuration parameter in a group.voidsetLastCas(java.lang.Object aCasObject)Deprecated.voidsetLastProcessedEntityId(java.lang.String aEntityId)Copies id of the last entity processed by the CasProcessor.voidsetMetadata(ProcessingResourceMetaData aMetadata)Sets component's input/output capabilities.voidsetProcessed(long aProcessedCount)Used when recovering from checkpoint, sets the total number of entities before CPE stopped.voidsetRemaining(long aRemainingCount)Copies number of entities the CasProcessor has yet to process.voidsetSingleFencedService(boolean aSingleFencedInstance)voidsetStatus(int aStatus)Changes the status of the CasProcessor as a group.voidstart()Deprecated.voidstop()Deprecated.-
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
getCasManager, getLogger, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, setMetaData, withContextHolder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.uima.resource.Resource
getLogger, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
-
-
-
-
Field Detail
-
CONTAINER_SLEEP_TIME
private static final int CONTAINER_SLEEP_TIME
The Constant CONTAINER_SLEEP_TIME.- See Also:
- Constant Field Values
-
casProcessorStatus
private int casProcessorStatus
The cas processor status.
-
configParams
private ConfigurationParameterSettings configParams
The config params.
-
isLocal
private boolean isLocal
The is local.
-
isRemote
private boolean isRemote
The is remote.
-
isIntegrated
private boolean isIntegrated
The is integrated.
-
batchCounter
private long batchCounter
The batch counter.
-
errorCounter
private int errorCounter
The error counter.
-
sampleCounter
private long sampleCounter
The sample counter.
-
failureThresholdSample
private long failureThresholdSample
The failure threshold sample.
-
configuredErrorRate
private int configuredErrorRate
The configured error rate.
-
batchSize
private int batchSize
The batch size.
-
processed
private long processed
The processed.
-
restartCount
private int restartCount
The restart count.
-
casProcessorCPEConfiguration
private CasProcessorConfiguration casProcessorCPEConfiguration
The cas processor CPE configuration.
-
bytesIn
private long bytesIn
The bytes in.
-
bytesOut
private long bytesOut
The bytes out.
-
retryCount
private int retryCount
The retry count.
-
abortCount
private int abortCount
The abort count.
-
filteredCount
private int filteredCount
The filtered count.
-
remaining
private long remaining
The remaining.
-
processedEntityIds
private java.util.Stack processedEntityIds
The processed entity ids.
-
totalTime
private long totalTime
The total time.
-
filterList
private java.util.LinkedList filterList
The filter list.
-
logPath
private java.lang.String logPath
The log path.
-
logger
private java.util.logging.Logger logger
The logger.
-
initialized
private boolean initialized
The initialized.
-
lastCas
private java.lang.Object lastCas
The last cas.
-
casProcessorPool
public ServiceProxyPool casProcessorPool
The cas processor pool.
-
casPDeployer
private CasProcessorDeployer casPDeployer
The cas P deployer.
-
metadata
private ProcessingResourceMetaData metadata
The metadata.
-
statMap
private java.util.HashMap statMap
The stat map.
-
isPaused
private boolean isPaused
The is paused.
-
singleFencedInstance
private boolean singleFencedInstance
The single fenced instance.
-
lockForIsPaused
private final java.lang.Object lockForIsPaused
The lock for is paused.
-
processorName
private java.lang.String processorName
The processor name.
-
fetchTime
private long fetchTime
The fetch time.
-
failedCasProcessorList
public java.util.LinkedList failedCasProcessorList
The failed cas processor list.
-
-
Constructor Detail
-
ProcessingContainer_Impl
public ProcessingContainer_Impl(CasProcessorConfiguration aCasProcessorConfig, ProcessingResourceMetaData aMetaData, ServiceProxyPool aCasProcessorPool) throws ResourceConfigurationException
Initialize container with CasProcessor configuration and pool containing instances of CasProcessor instances.- Parameters:
aCasProcessorConfig- - CasProcessor configuration as defined in cpe descriptoraMetaData- the a meta dataaCasProcessorPool- - pool of CasProcessor instances- Throws:
ResourceConfigurationException- the resource configuration exception
-
-
Method Detail
-
getMetadata
public ProcessingResourceMetaData getMetadata()
Returns component's input/output capabilities.- Returns:
- the metadata
-
setMetadata
public void setMetadata(ProcessingResourceMetaData aMetadata)
Sets component's input/output capabilities.- Specified by:
setMetadatain classProcessingContainer- Parameters:
aMetadata- component capabilities
-
setCasProcessorDeployer
public void setCasProcessorDeployer(CasProcessorDeployer aDeployer)
Plug in deployer object used to launch/deploy the CasProcessor instance. Used for restarts.- Specified by:
setCasProcessorDeployerin classProcessingContainer- Parameters:
aDeployer- - object responsible for deploying/launching CasProcessor
-
getDeployer
public CasProcessorDeployer getDeployer()
Returns deployer object used to launch the CasProcessor.- Specified by:
getDeployerin classProcessingContainer- Returns:
- - CasProcessorDeployer - deployer object
-
deployLogger
private void deployLogger()
Deploy Container specific logger to capture any exceptions occuring during CasProcessor(s) lifespan. Each CasProcessor may have its own log. It is optional and available when there is a parameter called 'containerLogPath' in thesection of the cpe descriptor. If
-
logAbortedCases
public void logAbortedCases(java.lang.Object[] abortedCasList)
Logs Cas'es that could not be processed.- Specified by:
logAbortedCasesin classProcessingContainer- Parameters:
abortedCasList- - an arrar of Cas'es that could not be processed by this CasProcessor
-
resetSampleCounter
private void resetSampleCounter()
Resets sample counter. This counter is used to determine acceptable error rates associated with hosted CasProcessor. Error rates are measured based on error rate in a given sample: 3 per 1000 for example, where 3 is an error rate and 1000 is a sample size.
-
resetBatchCounter
private void resetBatchCounter()
Resets batch counter. This counter is used to determine if the hosted CasProcessor should do special processing. A CasProcessor may buffer all Cas's in memory and only when its batch size is reached, it does something usefull with them, like save them to a file, index them, etc
-
getBytesIn
public long getBytesIn()
Returns total number of bytes ingested so far by all CasProcessor instances managed by this container.- Specified by:
getBytesInin classProcessingContainer- Returns:
- - bytes processed
-
addBytesIn
public void addBytesIn(long aBytesIn)
Aggregate total bytes ingested by the CasProcessor.- Specified by:
addBytesInin classProcessingContainer- Parameters:
aBytesIn- - number of ingested bytes
-
getBytesOut
public long getBytesOut()
Returns total number of bytes processed so far by all CasProcessor instances managed by this container.- Specified by:
getBytesOutin classProcessingContainer- Returns:
- - bytes processed
-
addBytesOut
public void addBytesOut(long aBytesOut)
Aggregate total bytes processed by this CasProcessor.- Specified by:
addBytesOutin classProcessingContainer- Parameters:
aBytesOut- the a bytes out
-
incrementRestartCount
public void incrementRestartCount(int aCount)
Increment number of times the casProcessor was restarted due to failures.- Specified by:
incrementRestartCountin classProcessingContainer- Parameters:
aCount- - restart count
-
getRestartCount
public int getRestartCount()
Returns total number of all CasProcessor restarts.- Specified by:
getRestartCountin classProcessingContainer- Returns:
- number of restarts
-
incrementRetryCount
public void incrementRetryCount(int aCount)
Increments number of times CasProceesor failed analyzing Cas'es due to timeout or some other problems.- Specified by:
incrementRetryCountin classProcessingContainer- Parameters:
aCount- - failure count
-
getRetryCount
public int getRetryCount()
Return the up todate number of retries recorded by the container.- Specified by:
getRetryCountin classProcessingContainer- Returns:
- - retry count
-
incrementAbortCount
public void incrementAbortCount(int aCount)
Increment number of aborted Cas'es due to inability to process the Cas.- Specified by:
incrementAbortCountin classProcessingContainer- Parameters:
aCount- - number of aborts while processing Cas'es
-
getAbortCount
public int getAbortCount()
Return the up todate number of aborts recorded by the container.- Specified by:
getAbortCountin classProcessingContainer- Returns:
- - number of failed attempts to analyze CAS'es
-
incrementFilteredCount
public void incrementFilteredCount(int aCount)
Increments number of CAS'es filtered by the CasProcessor. Filtered CAS'es dont contain required features. Features that are required by the Cas Processor to perform analysis. Dependant feateurs are defined in the filter expression in the CPE descriptor- Specified by:
incrementFilteredCountin classProcessingContainer- Parameters:
aCount- - number of filtered Cas'es
-
getFilteredCount
public int getFilteredCount()
Returns number of filtered Cas'es.- Specified by:
getFilteredCountin classProcessingContainer- Returns:
- # of filtered Cas'es
-
getRemaining
public long getRemaining()
Returns number of entities still to be processed by the CasProcessor It is a delta of total number of entities to be processed by the CPE minus number of entities processed so far.- Specified by:
getRemainingin classProcessingContainer- Returns:
- Number of entities yet to be processed
-
setRemaining
public void setRemaining(long aRemainingCount)
Copies number of entities the CasProcessor has yet to process.- Specified by:
setRemainingin classProcessingContainer- Parameters:
aRemainingCount- - number of entities to process
-
setLastProcessedEntityId
public void setLastProcessedEntityId(java.lang.String aEntityId)
Copies id of the last entity processed by the CasProcessor.- Specified by:
setLastProcessedEntityIdin classProcessingContainer- Parameters:
aEntityId- - id of the entity
-
getLastProcessedEntityId
public java.lang.String getLastProcessedEntityId()
Returns id of the last entity processed by the CasProcessor.- Specified by:
getLastProcessedEntityIdin classProcessingContainer- Returns:
- - id of entity
-
setLastCas
@Deprecated public void setLastCas(java.lang.Object aCasObject)
Deprecated.Copies the last Cas Processed.- Specified by:
setLastCasin classProcessingContainer- Parameters:
aCasObject- the new last cas
-
getLastCas
@Deprecated public java.lang.Object getLastCas()
Deprecated.Returns the last Cas processed.- Specified by:
getLastCasin classProcessingContainer- Returns:
- the last cas
-
incrementProcessed
public void incrementProcessed(int aIncrement)
Increment processed.- Parameters:
aIncrement- the a increment
-
setProcessed
public void setProcessed(long aProcessedCount)
Used when recovering from checkpoint, sets the total number of entities before CPE stopped.- Specified by:
setProcessedin classProcessingContainer- Parameters:
aProcessedCount- - number of entities processed before CPE stopped
-
getProcessed
public long getProcessed()
Returns number of entities processed so far.- Specified by:
getProcessedin classProcessingContainer- Returns:
- - processed - number of entities processed
-
resetErrorCounter
private void resetErrorCounter()
Re-initializes the error counter.
-
resetRestartCount
public void resetRestartCount()
- Specified by:
resetRestartCountin classProcessingContainer
-
incrementTotalTime
public void incrementTotalTime(long aTime)
Increments total time spend in the process() method of the CasProcessor.- Specified by:
incrementTotalTimein classProcessingContainer- Parameters:
aTime- - total time in process()
-
getTotalTime
public long getTotalTime()
Returns total time spent in process().- Specified by:
getTotalTimein classProcessingContainer- Returns:
- - number of millis spent in process()
-
abortCPMOnError
public boolean abortCPMOnError()
Returns true if maximum threshold for errors has been exceeded and the CasProcessor is configured to force CPE shutdown. It looks at the value of the action attribute of the <errorRateThreshold> element in the cpe descriptor.- Specified by:
abortCPMOnErrorin classProcessingContainer- Returns:
- - true if the CPE should stop processing, false otherwise
-
isTimeout
private boolean isTimeout(java.lang.Throwable aThrowable)
Returns true if the Exception cause is SocketTimeoutException.- Parameters:
aThrowable- - Exception to check for SocketTimeoutException- Returns:
- - true if Socket Timeout, false otherwise
-
incrementCasProcessorErrors
public void incrementCasProcessorErrors(java.lang.Throwable aThrowable) throws java.lang.ExceptionThis routine determines what to do with an exception thrown during the CasProcessor processing. It interprets given exception and throws a new one according to configuration specified in the CPE descriptor. It examines provided thresholds and determines if the CPE should continue to run, if it should disable the CasProcessor (and all its instances), or disregard the error and continue.- Specified by:
incrementCasProcessorErrorsin classProcessingContainer- Parameters:
aThrowable- - exception to examine- Throws:
java.lang.Exception- the exception
-
isEndOfBatch
public boolean isEndOfBatch(CasProcessor aCasProcessor, int aProcessedSize) throws ResourceProcessException, java.io.IOException
- Specified by:
isEndOfBatchin classProcessingContainer- Throws:
ResourceProcessExceptionjava.io.IOException
-
processCas
public boolean processCas(java.lang.Object[] aCasList)
Returns true if the Cas bundles should be processed by the CasProcessor. This routine checks for existance of dependent featues defined in the filter expression defined for the CasProcessor in the cpe descriptor. Currently this is done on per bundle basis. Meaning that all Cas'es must contain required features. If even one Cas does not have them, the entire bundle is skipped.- Specified by:
processCasin classProcessingContainer- Parameters:
aCasList- - bundle containing instances of CAS- Returns:
- true, if successful
-
hasFeature
private boolean hasFeature(CasData aCas)
Used during filtering, determines if a given Cas has a required feature. Required featured are defined in the filter. Filtering is optional and if not present in the cpe descriptor this routine always returns true.- Parameters:
aCas- - Cas instance to check- Returns:
- - true if feature is in the Cas, false otherwise
-
processCas
private boolean processCas(java.lang.Object aCas)
Checks if a given Cas has required features.- Parameters:
aCas- - Cas instance to check- Returns:
- - true if feature is in the Cas, false otherwise
-
getCasProcessorConfiguration
public CasProcessorConfiguration getCasProcessorConfiguration()
Returns CasProcessor configuration object. This object represents xml configuration defined in the <casProcessor> section of the cpe descriptor.- Specified by:
getCasProcessorConfigurationin classProcessingContainer- Returns:
CasProcessorConfigurationinstance
-
start
@Deprecated public void start()
Deprecated.Start.- Specified by:
startin interfaceRunnableContainer
-
stop
@Deprecated public void stop()
Deprecated.Stop.- Specified by:
stopin interfaceRunnableContainer
-
getCasProcessor
public CasProcessor getCasProcessor()
Returns available instance of the CasProcessor from the instance pool. It will wait indefinitely until an instance is available.- Specified by:
getCasProcessorin interfaceCasProcessorController- Returns:
- the cas processor
-
releaseCasProcessor
public void releaseCasProcessor(CasProcessor aCasProcessor)
Returns a given casProcessor instance back to the pool.- Specified by:
releaseCasProcessorin classProcessingContainer- Parameters:
aCasProcessor- - an instance of CasProcessor to return back to the pool- See Also:
ProcessingContainer.releaseCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
-
getStatus
public int getStatus()
Returns the current status of the CasProcessor.- Specified by:
getStatusin interfaceCasProcessorController- Returns:
- the status
-
setStatus
public void setStatus(int aStatus)
Changes the status of the CasProcessor as a group.- Specified by:
setStatusin interfaceCasProcessorController- Parameters:
aStatus- - new status
-
isLocal
@Deprecated public boolean isLocal()
Deprecated.Checks if is local.- Specified by:
isLocalin interfaceCasProcessorController- Returns:
- true, if is local
-
isRemote
@Deprecated public boolean isRemote()
Deprecated.Checks if is remote.- Specified by:
isRemotein interfaceCasProcessorController- Returns:
- true, if is remote
-
isIntegrated
@Deprecated public boolean isIntegrated()
Deprecated.Checks if is integrated.- Specified by:
isIntegratedin interfaceCasProcessorController- Returns:
- true, if is integrated
-
continueOnError
private boolean continueOnError()
Returns true if the CasProcessor has been configured to continue despite error.- Returns:
- - true if ignoring errors, false otherwise
-
isAbortable
public boolean isAbortable()
Determines if instances of CasProcessor managed by this container are abortable. Abortable CasProcessor's action attribute in the <errorRateThreshold> element has a value of 'disable'.- Specified by:
isAbortablein interfaceCasProcessorController- Returns:
- true if CasProcessor can be disabled
-
initialize
public boolean initialize(ResourceSpecifier aSpecifier, java.util.Map aAdditionalParams) throws ResourceInitializationException
Description copied from interface:ResourceInitializes thisResourcefrom aResourceSpecifier. Applications do not need to call this method. It is called automatically by theResourceFactoryand cannot be called a second time.- Specified by:
initializein interfaceResource- Overrides:
initializein classResource_ImplBase- Parameters:
aSpecifier- specifies how to create a resource or locate an existing resource service.aAdditionalParams- a Map containing additional parameters. May benullif there are no parameters. Each class that implements this interface can decide what additional parameters it supports.- Returns:
- true if and only if initialization completed successfully. Returns false if the given
ResourceSpecifieris not of an appropriate type for this Resource. If theResourceSpecifieris of an appropriate type but is invalid or if some other failure occurs, an exception should be thrown. - Throws:
ResourceInitializationException- if a failure occurs during initialization.- See Also:
multi-thread safe, given that each instance of this class is only called on one thread, once. The critical parts that update shared information (in shared uima context) are inside a synchronize block
-
destroy
public void destroy()
Destroy instances of CasProcessors managed by this container. Before destroying the instance, this method notifies it with CollectionProcessComplete so that the component finalizes its logic and does appropriate cleanup before shutdown.- Specified by:
destroyin interfaceResource- Overrides:
destroyin classResource_ImplBase- See Also:
Resource.destroy()
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
getConfigParameterValue
public java.lang.Object getConfigParameterValue(java.lang.String aParamName)
Description copied from interface:ConfigurableResourceLooks up the value of a configuration parameter. This method will only return the value of a parameter that is not defined in any group.This method returns
nullif the parameter is optional and has not been assigned a value. (For mandatory parameters, an exception is thrown during initialization if no value has been assigned.) This method also returnsnullif there is no declared configuration parameter with the specified name.- Specified by:
getConfigParameterValuein interfaceConfigurableResource- Parameters:
aParamName- the name of a parameter that is not in any group- Returns:
- the value of the parameter with name
aParamName,nullis either the parameter does not exist or it has not been assigned a value.
-
getConfigParameterValue
public java.lang.Object getConfigParameterValue(java.lang.String aGroupName, java.lang.String aParamName)Description copied from interface:ConfigurableResourceLooks up the value of a configuration parameter in a group. If the parameter has no value assigned within the group, fallback strategies will be followed.This method returns
nullif the parameter is optional and has not been assigned a value. (For mandatory parameters, an exception is thrown during initialization if no value has been assigned.) This method also returnsnullif there is no declared configuration parameter with the specified name.- Specified by:
getConfigParameterValuein interfaceConfigurableResource- Parameters:
aGroupName- the name of a configuration group. If the group name isnull, this method will return the same value asgetParameterValue(String).aParamName- the name of a parameter in the group- Returns:
- the value of the parameter in group
aGroupNamewith nameaParamName,,nullis either the parameter does not exist or it has not been assigned a value.
-
setConfigParameterValue
public void setConfigParameterValue(java.lang.String aParamName, java.lang.Object aValue)Description copied from interface:ConfigurableResourceSets the value of a configuration parameter. This only works for a parameter that is not defined in any group. Note that there is no guarantee that the change will take effect untilConfigurableResource.reconfigure()is called.- Specified by:
setConfigParameterValuein interfaceConfigurableResource- Parameters:
aParamName- the name of a parameter that is not in any groupaValue- the value to assign to the parameter
-
setConfigParameterValue
public void setConfigParameterValue(java.lang.String aGroupName, java.lang.String aParamName, java.lang.Object aValue)Description copied from interface:ConfigurableResourceSets the value of a configuration parameter in a group. Note that there is no guarantee that the change will take effect untilConfigurableResource.reconfigure()is called.- Specified by:
setConfigParameterValuein interfaceConfigurableResource- Parameters:
aGroupName- the name of a configuration group. If this parameter isnull, this method will have the same effect assetParameterValue(String,Object).aParamName- the name of a parameter in the groupaValue- the value to assign to the parameter.
-
reconfigure
public void reconfigure() throws ResourceConfigurationExceptionDescription copied from interface:ConfigurableResourceInstructs this Resource to re-read its configuration parameter settings.- Specified by:
reconfigurein interfaceConfigurableResource- Throws:
ResourceConfigurationException- if the configuration is not valid
-
getName
public java.lang.String getName()
Returns the name of this container. It is the name of the Cas Processor.- Specified by:
getNamein classProcessingContainer- Returns:
- the name
-
getMetaData
public ResourceMetaData getMetaData()
Description copied from interface:ResourceGets the metadata that describes thisResource.- Specified by:
getMetaDatain interfaceResource- Overrides:
getMetaDatain classResource_ImplBase- Returns:
- an object containing all metadata for this resource.
- See Also:
Resource.getMetaData()
-
incrementStat
public void incrementStat(java.lang.String aStatName, java.lang.Integer aStat)Increment a value of a given stat.- Specified by:
incrementStatin classProcessingContainer- Parameters:
aStatName- the a stat nameaStat- the a stat
-
addStat
public void addStat(java.lang.String aStatName, java.lang.Object aStat)Add an arbitrary object and bind it to a given name.- Specified by:
addStatin classProcessingContainer- Parameters:
aStatName- the a stat nameaStat- the a stat
-
getStat
public java.lang.Object getStat(java.lang.String aStatName)
Return an abject identified with a given name.- Specified by:
getStatin classProcessingContainer- Parameters:
aStatName- the a stat name- Returns:
- the stat
-
getAllStats
public java.util.HashMap getAllStats()
Returns all stats aggregate during the CPM run.- Specified by:
getAllStatsin classProcessingContainer- Returns:
- a map of all stats aggregated during the CPM run
-
pause
public void pause()
Pauses the container until resumed. The CPM will pause to the Container while it is trying to re-connect to a shared remote service. While the Container is paused getCasProcessor() will not be allowed to return a new CasProcessor. All other methods are accessible and will function fine.- Specified by:
pausein classProcessingContainer
-
resume
public void resume()
- Specified by:
resumein classProcessingContainer
-
isPaused
public boolean isPaused()
- Specified by:
isPausedin classProcessingContainer
-
getPool
public ServiceProxyPool getPool()
- Specified by:
getPoolin classProcessingContainer
-
setSingleFencedService
public void setSingleFencedService(boolean aSingleFencedInstance)
- Specified by:
setSingleFencedServicein classProcessingContainer
-
isSingleFencedService
public boolean isSingleFencedService()
- Specified by:
isSingleFencedServicein classProcessingContainer
-
getFetchTime
public long getFetchTime()
Gets the fetch time.- Returns:
- the fetch time
-
-