|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.uima.resource.Resource_ImplBase
org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer
org.apache.uima.collection.impl.cpm.container.ProcessingContainer_Impl
public class ProcessingContainer_Impl
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 | |
|---|---|
ServiceProxyPool |
casProcessorPool
|
java.util.LinkedList |
failedCasProcessorList
|
| Fields inherited from interface org.apache.uima.resource.Resource |
|---|
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_PARAM_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT |
| Fields inherited from interface org.apache.uima.collection.impl.base_cpm.container.CasProcessorController |
|---|
DISABLED, INITIALIZED, KILLED, NOTINITIALIZED, RUNNING |
| Constructor Summary | |
|---|---|
ProcessingContainer_Impl(CasProcessorConfiguration aCasProcessorConfig,
ProcessingResourceMetaData aMetaData,
ServiceProxyPool aCasProcessorPool)
Initialize container with CasProcessor configuration and pool containing instances of CasProcessor instances. |
|
| Method Summary | |
|---|---|
boolean |
abortCPMOnError()
Returns true if maximum threshold for errors has been exceeded and the CasProcessor is configured to force CPE shutdown. |
void |
addBytesIn(long aBytesIn)
Aggregate total bytes ingested by the CasProcessor. |
void |
addBytesOut(long aBytesOut)
Aggregate total bytes processed by this CasProcessor |
void |
addStat(java.lang.String aStatName,
java.lang.Object aStat)
Add an arbitrary object and bind it to a given name |
void |
destroy()
Destroy instances of CasProcessors managed by this container. |
int |
getAbortCount()
Return the up todate number of aborts recorded by the container |
java.util.HashMap |
getAllStats()
Returns all stats aggregate during the CPM run |
long |
getBytesIn()
Returns total number of bytes ingested so far by all CasProcessor instances managed by this container. |
long |
getBytesOut()
Returns total number of bytes processed so far by all CasProcessor instances managed by this container. |
CasProcessor |
getCasProcessor()
Returns available instance of the CasProcessor from the instance pool. |
CasProcessorConfiguration |
getCasProcessorConfiguration()
Returns CasProcessor configuration object. |
java.lang.Object |
getConfigParameterValue(java.lang.String aParamName)
Looks up the value of a configuration parameter. |
java.lang.Object |
getConfigParameterValue(java.lang.String aGroupName,
java.lang.String aParamName)
Looks up the value of a configuration parameter in a group. |
CasProcessorDeployer |
getDeployer()
Returns deployer object used to launch the CasProcessor |
long |
getFetchTime()
|
int |
getFilteredCount()
Returns number of filtered Cas'es |
java.lang.Object |
getLastCas()
Deprecated. |
java.lang.String |
getLastProcessedEntityId()
Returns id of the last entity processed by the CasProcessor |
ProcessingResourceMetaData |
getMetadata()
Returns component's input/output capabilities |
ResourceMetaData |
getMetaData()
Gets the metadata that describes this Resource. |
java.lang.String |
getName()
Returns the name of this container. |
ServiceProxyPool |
getPool()
|
long |
getProcessed()
Returns number of entities processed so far. |
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. |
int |
getRestartCount()
Returns total number of all CasProcessor restarts. |
int |
getRetryCount()
Return the up todate number of retries recorded by the container. |
java.lang.Object |
getStat(java.lang.String aStatName)
Return an abject identified with a given name |
int |
getStatus()
Returns the current status of the CasProcessor |
long |
getTotalTime()
Returns total time spent in process() |
void |
incrementAbortCount(int aCount)
Increment number of aborted Cas'es due to inability to process the Cas |
void |
incrementCasProcessorErrors(java.lang.Throwable aThrowable)
This routine determines what to do with an exception thrown during the CasProcessor processing. |
void |
incrementFilteredCount(int aCount)
Increments number of CAS'es filtered by the CasProcessor. |
void |
incrementProcessed(int aIncrement)
|
void |
incrementRestartCount(int aCount)
Increment number of times the casProcessor was restarted due to failures |
void |
incrementRetryCount(int aCount)
Increments number of times CasProceesor failed analyzing Cas'es due to timeout or some other problems |
void |
incrementStat(java.lang.String aStatName,
java.lang.Integer aStat)
Increment a value of a given stat |
void |
incrementTotalTime(long aTime)
Increments total time spend in the process() method of the CasProcessor |
boolean |
initialize(ResourceSpecifier aSpecifier,
java.util.Map aAdditionalParams)
Initializes this Resource from a ResourceSpecifier. |
boolean |
isAbortable()
Determines if instances of CasProcessor managed by this container are abortable. |
boolean |
isEndOfBatch(CasProcessor aCasProcessor,
int aProcessedSize)
|
boolean |
isIntegrated()
Deprecated. |
boolean |
isLocal()
Deprecated. |
boolean |
isPaused()
|
boolean |
isRemote()
Deprecated. |
boolean |
isSingleFencedService()
|
void |
logAbortedCases(java.lang.Object[] abortedCasList)
Logs Cas'es that could not be processed. |
void |
pause()
Pauses the container until resumed. |
boolean |
processCas(java.lang.Object[] aCasList)
Returns true if the Cas bundles should be processed by the CasProcessor. |
void |
reconfigure()
Instructs this Resource to re-read its configuration parameter settings. |
void |
releaseCasProcessor(CasProcessor aCasProcessor)
Returns a given casProcessor instance back to the pool. |
void |
resetRestartCount()
|
void |
resume()
|
void |
run()
|
void |
setCasProcessorDeployer(CasProcessorDeployer aDeployer)
Plug in deployer object used to launch/deploy the CasProcessor instance. |
void |
setConfigParameterValue(java.lang.String aParamName,
java.lang.Object aValue)
Sets the value of a configuration parameter. |
void |
setConfigParameterValue(java.lang.String aGroupName,
java.lang.String aParamName,
java.lang.Object aValue)
Sets the value of a configuration parameter in a group. |
void |
setLastCas(java.lang.Object aCasObject)
Deprecated. |
void |
setLastProcessedEntityId(java.lang.String aEntityId)
Copies id of the last entity processed by the CasProcessor |
void |
setMetadata(ProcessingResourceMetaData aMetadata)
Sets component's input/output capabilities |
void |
setProcessed(long aProcessedCount)
Used when recovering from checkpoint, sets the total number of entities before CPE stopped. |
void |
setRemaining(long aRemainingCount)
Copies number of entities the CasProcessor has yet to process. |
void |
setSingleFencedService(boolean aSingleFencedInstance)
|
void |
setStatus(int aStatus)
Changes the status of the CasProcessor as a group |
void |
start()
Deprecated. |
void |
stop()
Deprecated. |
| Methods inherited from class org.apache.uima.resource.Resource_ImplBase |
|---|
getCasManager, getLogger, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger, setMetaData |
| 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 |
|---|
public ServiceProxyPool casProcessorPool
public java.util.LinkedList failedCasProcessorList
| Constructor Detail |
|---|
public ProcessingContainer_Impl(CasProcessorConfiguration aCasProcessorConfig,
ProcessingResourceMetaData aMetaData,
ServiceProxyPool aCasProcessorPool)
throws ResourceConfigurationException
aCasProcessorConfig - -
CasProcessor configuration as defined in cpe descriptoraCasProcessorPool - -
pool of CasProcessor instances
ResourceConfigurationException| Method Detail |
|---|
public ProcessingResourceMetaData getMetadata()
public void setMetadata(ProcessingResourceMetaData aMetadata)
setMetadata in class ProcessingContainerCapability - -
component capabilitiespublic void setCasProcessorDeployer(CasProcessorDeployer aDeployer)
setCasProcessorDeployer in class ProcessingContaineraDeployer - -
object responsible for deploying/launching CasProcessorpublic CasProcessorDeployer getDeployer()
getDeployer in class ProcessingContainerpublic void logAbortedCases(java.lang.Object[] abortedCasList)
logAbortedCases in class ProcessingContainerabortedCasList - -
an arrar of Cas'es that could not be processed by this CasProcessorpublic long getBytesIn()
getBytesIn in class ProcessingContainerpublic void addBytesIn(long aBytesIn)
addBytesIn in class ProcessingContainer- - aBytesIn - number of ingested bytespublic long getBytesOut()
getBytesOut in class ProcessingContainerpublic void addBytesOut(long aBytesOut)
addBytesOut in class ProcessingContainerpublic void incrementRestartCount(int aCount)
incrementRestartCount in class ProcessingContainer- - aCount - restart countpublic int getRestartCount()
getRestartCount in class ProcessingContainer- - number of restartspublic void incrementRetryCount(int aCount)
incrementRetryCount in class ProcessingContainer- - aCount - failure countpublic int getRetryCount()
getRetryCount in class ProcessingContainerpublic void incrementAbortCount(int aCount)
incrementAbortCount in class ProcessingContainer- - aCount - number of aborts while processing Cas'espublic int getAbortCount()
getAbortCount in class ProcessingContainerpublic void incrementFilteredCount(int aCount)
incrementFilteredCount in class ProcessingContaineraCount - -
number of filtered Cas'espublic int getFilteredCount()
getFilteredCount in class ProcessingContainerpublic long getRemaining()
getRemaining in class ProcessingContainerpublic void setRemaining(long aRemainingCount)
setRemaining in class ProcessingContaineraRemainingCount - -
number of entities to processpublic void setLastProcessedEntityId(java.lang.String aEntityId)
setLastProcessedEntityId in class ProcessingContainer- - aEntityId - id of the entitypublic java.lang.String getLastProcessedEntityId()
getLastProcessedEntityId in class ProcessingContainer@Deprecated public void setLastCas(java.lang.Object aCasObject)
setLastCas in class ProcessingContainer@Deprecated public java.lang.Object getLastCas()
getLastCas in class ProcessingContainerpublic void incrementProcessed(int aIncrement)
public void setProcessed(long aProcessedCount)
setProcessed in class ProcessingContainer- - aProcessedCount - number of entities processed before CPE stoppedpublic long getProcessed()
getProcessed in class ProcessingContainerpublic void resetRestartCount()
resetRestartCount in class ProcessingContainerpublic void incrementTotalTime(long aTime)
incrementTotalTime in class ProcessingContaineraTime - -
total time in process()public long getTotalTime()
getTotalTime in class ProcessingContainerpublic boolean abortCPMOnError()
abortCPMOnError in class ProcessingContainer
public void incrementCasProcessorErrors(java.lang.Throwable aThrowable)
throws java.lang.Exception
incrementCasProcessorErrors in class ProcessingContainerAbortCPMException - -
force the CPE to stop processing
AbortCasProcessorException - -
disables all instances of CasProcessor in this container
ServiceConnectionException - -
forces the restart/relauch of the failed CasProcessor
SkipCasException - -
disregard error, skip bad Cas'es and continue with the next Cas bundle
java.lang.Exception
public boolean isEndOfBatch(CasProcessor aCasProcessor,
int aProcessedSize)
throws ResourceProcessException,
java.io.IOException
isEndOfBatch in class ProcessingContainerResourceProcessException
java.io.IOExceptionpublic boolean processCas(java.lang.Object[] aCasList)
processCas in class ProcessingContaineraCasList - -
bundle containing instances of CASpublic CasProcessorConfiguration getCasProcessorConfiguration()
getCasProcessorConfiguration in class ProcessingContainerCasProcessorConfiguration instance@Deprecated public void start()
RunnableContainer
start in interface RunnableContainer@Deprecated public void stop()
RunnableContainer
stop in interface RunnableContainerpublic CasProcessor getCasProcessor()
getCasProcessor in interface CasProcessorControllerpublic void releaseCasProcessor(CasProcessor aCasProcessor)
releaseCasProcessor in class ProcessingContaineraCasProcessor - -
an instance of CasProcessor to return back to the poolProcessingContainer.releaseCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)public int getStatus()
getStatus in interface CasProcessorControllerpublic void setStatus(int aStatus)
setStatus in interface CasProcessorControlleraStatus - -
new status@Deprecated public boolean isLocal()
CasProcessorController
isLocal in interface CasProcessorController@Deprecated public boolean isRemote()
CasProcessorController
isRemote in interface CasProcessorController@Deprecated public boolean isIntegrated()
CasProcessorController
isIntegrated in interface CasProcessorControllerpublic boolean isAbortable()
isAbortable in interface CasProcessorController
public boolean initialize(ResourceSpecifier aSpecifier,
java.util.Map aAdditionalParams)
throws ResourceInitializationException
ResourceResource from a ResourceSpecifier. Applications
do not need to call this method. It is called automatically by the ResourceFactory
and cannot be called a second time.
initialize in interface Resourceinitialize in class Resource_ImplBaseaSpecifier - specifies how to create a resource or locate an existing resource service.aAdditionalParams - a Map containing additional parameters. May be null if there are no
parameters. Each class that implements this interface can decide what additional
parameters it supports.
ResourceSpecifier is not of an appropriate type for this Resource. If
the ResourceSpecifier is of an appropriate type but is invalid or if
some other failure occurs, an exception should be thrown.
ResourceInitializationException - if a failure occurs during initialization.Resource.initialize(org.apache.uima.resource.ResourceSpecifier,
java.util.Map)public void destroy()
destroy in interface Resourcedestroy in class Resource_ImplBaseResource.destroy()public void run()
run in interface java.lang.Runnablepublic java.lang.Object getConfigParameterValue(java.lang.String aParamName)
ConfigurableResource
This method returns null if 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 returns null if there is no declared
configuration parameter with the specified name.
getConfigParameterValue in interface ConfigurableResourceaParamName - the name of a parameter that is not in any group
aParamName, null is
either the parameter does not exist or it has not been assigned a value.
public java.lang.Object getConfigParameterValue(java.lang.String aGroupName,
java.lang.String aParamName)
ConfigurableResource
This method returns null if 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 returns null if there is no declared
configuration parameter with the specified name.
getConfigParameterValue in interface ConfigurableResourceaGroupName - the name of a configuration group. If the group name is
null, this method will return the same value as
getParameterValue(String).aParamName - the name of a parameter in the group
- Returns:
- the value of the parameter in group
aGroupName with
name aParamName,,null is either the
parameter does not exist or it has not been assigned a value.
public void setConfigParameterValue(java.lang.String aParamName,
java.lang.Object aValue)
ConfigurableResourceConfigurableResource.reconfigure() is called.
setConfigParameterValue in interface ConfigurableResourceaParamName - the name of a parameter that is not in any groupaValue - the value to assign to the parameter
public void setConfigParameterValue(java.lang.String aGroupName,
java.lang.String aParamName,
java.lang.Object aValue)
ConfigurableResourceConfigurableResource.reconfigure() is called.
setConfigParameterValue in interface ConfigurableResourceaGroupName - the name of a configuration group. If this parameter is
null, this method will have the same effet as
setParameterValue(String,Object).aParamName - the name of a parameter in the groupaValue - the value to assign to the parameter.
public void reconfigure()
throws ResourceConfigurationException
ConfigurableResource
reconfigure in interface ConfigurableResourceResourceConfigurationException - if the configuration is not validpublic java.lang.String getName()
getName in class ProcessingContainerpublic ResourceMetaData getMetaData()
ResourceResource.
getMetaData in interface ResourcegetMetaData in class Resource_ImplBaseResource.getMetaData()
public void incrementStat(java.lang.String aStatName,
java.lang.Integer aStat)
incrementStat in class ProcessingContainer
public void addStat(java.lang.String aStatName,
java.lang.Object aStat)
addStat in class ProcessingContainerpublic java.lang.Object getStat(java.lang.String aStatName)
getStat in class ProcessingContainerpublic java.util.HashMap getAllStats()
getAllStats in class ProcessingContainerpublic void pause()
pause in class ProcessingContainerpublic void resume()
resume in class ProcessingContainerpublic boolean isPaused()
isPaused in class ProcessingContainerpublic ServiceProxyPool getPool()
getPool in class ProcessingContainerpublic void setSingleFencedService(boolean aSingleFencedInstance)
setSingleFencedService in class ProcessingContainerpublic boolean isSingleFencedService()
isSingleFencedService in class ProcessingContainerpublic long getFetchTime()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||