public class ProcessingContainer_Impl extends ProcessingContainer implements RunnableContainer
Modifier and Type | Field and Description |
---|---|
ServiceProxyPool |
casProcessorPool |
LinkedList |
failedCasProcessorList |
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
DISABLED, INITIALIZED, KILLED, NOTINITIALIZED, RUNNING
Constructor and Description |
---|
ProcessingContainer_Impl(CasProcessorConfiguration aCasProcessorConfig,
ProcessingResourceMetaData aMetaData,
ServiceProxyPool aCasProcessorPool)
Initialize container with CasProcessor configuration and pool containing instances of
CasProcessor instances.
|
Modifier and Type | Method and Description |
---|---|
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(String aStatName,
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
|
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.
|
Object |
getConfigParameterValue(String aParamName)
Looks up the value of a configuration parameter.
|
Object |
getConfigParameterValue(String aGroupName,
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
|
Object |
getLastCas()
Deprecated.
|
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 . |
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.
|
Object |
getStat(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(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(String aStatName,
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,
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(Object[] abortedCasList)
Logs Cas'es that could not be processed.
|
void |
pause()
Pauses the container until resumed.
|
boolean |
processCas(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(String aParamName,
Object aValue)
Sets the value of a configuration parameter.
|
void |
setConfigParameterValue(String aGroupName,
String aParamName,
Object aValue)
Sets the value of a configuration parameter in a group.
|
void |
setLastCas(Object aCasObject)
Deprecated.
|
void |
setLastProcessedEntityId(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.
|
getCasManager, getLogger, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger, setMetaData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLogger, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
public ServiceProxyPool casProcessorPool
public LinkedList failedCasProcessorList
public ProcessingContainer_Impl(CasProcessorConfiguration aCasProcessorConfig, ProcessingResourceMetaData aMetaData, ServiceProxyPool aCasProcessorPool) throws ResourceConfigurationException
aCasProcessorConfig
- -
CasProcessor configuration as defined in cpe descriptoraCasProcessorPool
- -
pool of CasProcessor instancesResourceConfigurationException
public ProcessingResourceMetaData getMetadata()
public void setMetadata(ProcessingResourceMetaData aMetadata)
setMetadata
in class ProcessingContainer
aMetadata
- component capabilitiespublic void setCasProcessorDeployer(CasProcessorDeployer aDeployer)
setCasProcessorDeployer
in class ProcessingContainer
aDeployer
- -
object responsible for deploying/launching CasProcessorpublic CasProcessorDeployer getDeployer()
getDeployer
in class ProcessingContainer
public void logAbortedCases(Object[] abortedCasList)
logAbortedCases
in class ProcessingContainer
abortedCasList
- -
an arrar of Cas'es that could not be processed by this CasProcessorpublic long getBytesIn()
getBytesIn
in class ProcessingContainer
public void addBytesIn(long aBytesIn)
addBytesIn
in class ProcessingContainer
aBytesIn
- - number of ingested bytespublic long getBytesOut()
getBytesOut
in class ProcessingContainer
public void addBytesOut(long aBytesOut)
addBytesOut
in class ProcessingContainer
public void incrementRestartCount(int aCount)
incrementRestartCount
in class ProcessingContainer
aCount
- - restart countpublic int getRestartCount()
getRestartCount
in class ProcessingContainer
public void incrementRetryCount(int aCount)
incrementRetryCount
in class ProcessingContainer
aCount
- - failure countpublic int getRetryCount()
getRetryCount
in class ProcessingContainer
public void incrementAbortCount(int aCount)
incrementAbortCount
in class ProcessingContainer
aCount
- - number of aborts while processing Cas'espublic int getAbortCount()
getAbortCount
in class ProcessingContainer
public void incrementFilteredCount(int aCount)
incrementFilteredCount
in class ProcessingContainer
aCount
- -
number of filtered Cas'espublic int getFilteredCount()
getFilteredCount
in class ProcessingContainer
public long getRemaining()
getRemaining
in class ProcessingContainer
public void setRemaining(long aRemainingCount)
setRemaining
in class ProcessingContainer
aRemainingCount
- -
number of entities to processpublic void setLastProcessedEntityId(String aEntityId)
setLastProcessedEntityId
in class ProcessingContainer
aEntityId
- - id of the entitypublic String getLastProcessedEntityId()
getLastProcessedEntityId
in class ProcessingContainer
@Deprecated public void setLastCas(Object aCasObject)
setLastCas
in class ProcessingContainer
@Deprecated public Object getLastCas()
getLastCas
in class ProcessingContainer
public 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 ProcessingContainer
public void resetRestartCount()
resetRestartCount
in class ProcessingContainer
public void incrementTotalTime(long aTime)
incrementTotalTime
in class ProcessingContainer
aTime
- -
total time in process()public long getTotalTime()
getTotalTime
in class ProcessingContainer
public boolean abortCPMOnError()
abortCPMOnError
in class ProcessingContainer
public void incrementCasProcessorErrors(Throwable aThrowable) throws Exception
incrementCasProcessorErrors
in class ProcessingContainer
aThrowable
- - exception to examineAbortCPMException
- -
force the CPE to stop processingAbortCasProcessorException
- -
disables all instances of CasProcessor in this containerServiceConnectionException
- -
forces the restart/relauch of the failed CasProcessorSkipCasException
- -
disregard error, skip bad Cas'es and continue with the next Cas bundleException
public boolean isEndOfBatch(CasProcessor aCasProcessor, int aProcessedSize) throws ResourceProcessException, IOException
isEndOfBatch
in class ProcessingContainer
ResourceProcessException
IOException
public boolean processCas(Object[] aCasList)
processCas
in class ProcessingContainer
aCasList
- -
bundle containing instances of CASpublic CasProcessorConfiguration getCasProcessorConfiguration()
getCasProcessorConfiguration
in class ProcessingContainer
CasProcessorConfiguration
instance@Deprecated public void start()
RunnableContainer
start
in interface RunnableContainer
@Deprecated public void stop()
RunnableContainer
stop
in interface RunnableContainer
public CasProcessor getCasProcessor()
getCasProcessor
in interface CasProcessorController
public void releaseCasProcessor(CasProcessor aCasProcessor)
releaseCasProcessor
in class ProcessingContainer
aCasProcessor
- -
an instance of CasProcessor to return back to the poolProcessingContainer.releaseCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
public int getStatus()
getStatus
in interface CasProcessorController
public void setStatus(int aStatus)
setStatus
in interface CasProcessorController
aStatus
- -
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 CasProcessorController
public boolean isAbortable()
isAbortable
in interface CasProcessorController
public boolean initialize(ResourceSpecifier aSpecifier, Map aAdditionalParams) throws ResourceInitializationException
Resource
Resource
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 Resource
initialize
in class Resource_ImplBase
aSpecifier
- 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.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
public void destroy()
destroy
in interface Resource
destroy
in class Resource_ImplBase
Resource.destroy()
public Object getConfigParameterValue(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 ConfigurableResource
aParamName
- the name of a parameter that is not in any groupaParamName
, null
is
either the parameter does not exist or it has not been assigned a value.public Object getConfigParameterValue(String aGroupName, 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 ConfigurableResource
aGroupName
- 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 groupaGroupName
with
name aParamName
,,null
is either the
parameter does not exist or it has not been assigned a value.public void setConfigParameterValue(String aParamName, Object aValue)
ConfigurableResource
ConfigurableResource.reconfigure()
is called.setConfigParameterValue
in interface ConfigurableResource
aParamName
- the name of a parameter that is not in any groupaValue
- the value to assign to the parameterpublic void setConfigParameterValue(String aGroupName, String aParamName, Object aValue)
ConfigurableResource
ConfigurableResource.reconfigure()
is called.setConfigParameterValue
in interface ConfigurableResource
aGroupName
- the name of a configuration group. If this parameter is
null
, this method will have the same effect 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 ConfigurableResource
ResourceConfigurationException
- if the configuration is not validpublic String getName()
getName
in class ProcessingContainer
public ResourceMetaData getMetaData()
Resource
Resource
.getMetaData
in interface Resource
getMetaData
in class Resource_ImplBase
Resource.getMetaData()
public void incrementStat(String aStatName, Integer aStat)
incrementStat
in class ProcessingContainer
public void addStat(String aStatName, Object aStat)
addStat
in class ProcessingContainer
public Object getStat(String aStatName)
getStat
in class ProcessingContainer
public HashMap getAllStats()
getAllStats
in class ProcessingContainer
public void pause()
pause
in class ProcessingContainer
public void resume()
resume
in class ProcessingContainer
public boolean isPaused()
isPaused
in class ProcessingContainer
public ServiceProxyPool getPool()
getPool
in class ProcessingContainer
public void setSingleFencedService(boolean aSingleFencedInstance)
setSingleFencedService
in class ProcessingContainer
public boolean isSingleFencedService()
isSingleFencedService
in class ProcessingContainer
public long getFetchTime()
Copyright © 2014. All rights reserved.