Package org.apache.uima.aae.controller
Class BaseAnalysisEngineController
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.aae.controller.BaseAnalysisEngineController
-
- All Implemented Interfaces:
AnalysisEngineController
,ControllerLifecycle
,EventSubscriber
,org.apache.uima.resource.Resource
- Direct Known Subclasses:
AggregateAnalysisEngineController_impl
,PrimitiveAnalysisEngineController_impl
public abstract class BaseAnalysisEngineController extends org.apache.uima.resource.Resource_ImplBase implements AnalysisEngineController, EventSubscriber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseAnalysisEngineController.ServiceState
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String>
abortedCasesMap
protected java.lang.String
aeDescriptor
protected boolean
allDelegatesAreRemote
protected boolean
awaitingCacheCallbackNotification
protected java.lang.Object
callbackMonitor
protected boolean
callbackReceived
protected Endpoint
clientEndpoint
protected java.util.concurrent.ConcurrentHashMap
cmOutstandingCASes
protected int
componentCasPoolSize
protected java.util.List
controllerListeners
protected BaseAnalysisEngineController.ServiceState
currentState
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String>
deadClientDestinationMap
protected java.lang.String
delegateKey
protected java.util.List<Delegate>
delegates
protected long
errorCount
protected ErrorHandlerChain
errorHandlerChain
protected java.lang.Object
finalStepMux
protected long
idleTime
protected InputChannel
inputChannel
protected java.util.List
inputChannelList
protected java.util.concurrent.ConcurrentHashMap
inputChannelMap
protected java.lang.String
jmxContext
protected ControllerLatch
latch
protected LocalCache
localCache
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,UimaMessageListener>
messageListeners
protected Monitor
monitor
static boolean
NO_RECOVERY
protected java.util.HashMap
paramsMap
protected AnalysisEngineController
parentController
protected java.util.concurrent.ConcurrentHashMap
perCasStatistics
protected java.lang.String
processPid
protected long
replyTime
protected org.apache.uima.resource.ResourceSpecifier
resourceSpecifier
protected java.util.concurrent.ConcurrentHashMap
serviceErrorMap
protected ServiceErrors
serviceErrors
protected boolean
serviceInitialized
protected ServicePerformance
servicePerformance
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Long>
statsMap
protected boolean
stopped
protected java.lang.Object
syncObject
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,UimaTransport>
transports
protected java.util.List
unregisteredDelegateList
-
Fields inherited from interface org.apache.uima.aae.controller.AnalysisEngineController
AEInstanceCount, CasPoolSize
-
-
Constructor Summary
Constructors Constructor Description BaseAnalysisEngineController()
BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, long anInitialCasHeapSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache, java.util.Map aDestinationMap, JmxManagement aJmxManagement)
BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache)
BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache, java.util.Map aDestinationMap)
BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache, java.util.Map aDestinationMap, JmxManagement aJmxManagement)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
abortGeneratingCASes(java.lang.String aCasReferenceId)
Returns true if a given CAS id is in the list of aborted CASes.void
addAbortedCasReferenceId(java.lang.String aCasReferenceId)
void
addControllerCallbackListener(ControllerCallbackListener aListener)
Register one or more listeners through which the controller can send notification of events.void
addInputChannel(InputChannel anInputChannel)
void
addServiceInfo(ServiceInfo aServiceInfo)
void
beginProcess(int msgType)
void
cacheClientEndpoint(Endpoint anEndpoint)
void
changeState(BaseAnalysisEngineController.ServiceState state)
protected void
cleanUp()
protected void
clearStats()
Clears controller statistics.void
dropCAS(java.lang.String aCasReferenceId, boolean deleteCacheEntry)
void
dropCAS(org.apache.uima.cas.CAS aCAS)
protected void
dropCasStatistics(java.lang.String aCasReferenceId)
void
dropStats(java.lang.String aCasReferenceId, java.lang.String anEndpointName)
Removes statistics from the global Mapabstract void
dumpState(java.lang.StringBuffer buffer, java.lang.String lbl1)
void
endProcess(int msgType)
protected boolean
exceedsThresholdWithinWindow(int threshold, long docCount, int windowSize)
void
forceTimeoutOnPendingCases(java.lang.String key)
long
getAnalysisTime()
Returns the total CPU time all processing threads spent in analysis.java.lang.String
getBrokerURL()
AsynchAECasManager
getCasManagerWrapper()
AnalysisEngineController
getCasMultiplierController(java.lang.String cmKey)
Aggregates have more than one Listener channel.ServicePerformance
getCasStatistics(java.lang.String aCasReferenceId)
Returns stats associated with a given CAS.org.apache.uima.UimaContext
getChildUimaContext(java.lang.String aDelegateEndpointName)
Endpoint
getClientEndpoint()
java.lang.String
getComponentName()
Returns the name of the component.long
getCpuTime()
Returns CPU Time with nanosecond precision (not nanosecond accuracy).java.util.Map<java.lang.String,java.lang.String>
getDeadClientMap()
java.lang.String
getDeploymentDescriptor()
java.lang.String
getDeploymentMode()
ErrorHandlerChain
getErrorHandlerChain()
EventSubscriber
getEventListener()
Returns interface via which this instance receives callbackslong
getIdleTime()
long
getIdleTimeBetweenProcessCalls(int msgType)
int
getIndex()
Returns a unique id for each component in the service hierarchy.InProcessCache
getInProcessCache()
InputChannel
getInputChannel()
InputChannel
getInputChannel(java.lang.String anEndpointName)
java.lang.String
getInputQueue()
java.lang.String
getJmxContext()
This is called once during initialization to compute the position of the component in the JMX hierarchy and create a context path that will be used to register the component in the JMX registry.java.lang.String
getJMXDomain()
Get the domain for Uima JMX.java.lang.String
getKey()
LocalCache
getLocalCache()
JmxManagement
getManagementInterface()
java.lang.String
getName()
OutputChannel
getOutputChannel()
AnalysisEngineController
getParentController()
InputChannel
getReplyInputChannel(java.lang.String aDelegateKey)
long
getReplyTime()
protected org.apache.uima.resource.ResourceSpecifier
getResourceSpecifier()
ServiceErrors
getServiceErrors()
java.lang.String
getServiceName()
ServicePerformance
getServicePerformance()
BaseAnalysisEngineController.ServiceState
getState()
java.util.Map
getStats()
Returns a copy of the controller statistics.long
getTime(java.lang.String aCasReferenceId, java.lang.String anEndpointName)
long
getTotalNumberOfCASesDropped()
long
getTotalNumberOfCASesProcessed()
long
getTotalNumberOfCASesReceived()
long
getTotalNumberOfErrors()
long
getTotalTimeSpendDeSerializingCAS()
long
getTotalTimeSpentSerializingCAS()
long
getTotalTimeSpentWaitingForFreeCASInstance()
UimaTransport
getTransport(java.lang.String aKey)
UimaTransport
getTransport(UimaAsContext asContext)
UimaTransport
getTransport(UimaAsContext asContext, java.lang.String aKey)
UimaEEAdminContext
getUimaEEAdminContext()
UimaMessageListener
getUimaMessageListener(java.lang.String aDelegateKey)
protected void
handleAction(java.lang.String anAction, java.lang.String anEndpoint, ErrorContext anErrorContext)
void
handleError(java.util.HashMap aMap, java.lang.Throwable e)
void
incrementDeserializationTime(long cpuTime)
Increments the time this thread spent in deserialization of a CASprotected void
incrementErrorCounter()
void
incrementSerializationTime(long cpuTime)
Increments the time this thread spent in serialization of a CASvoid
initializeVMTransport(int parentControllerReplyConsumerCount)
Initializes transport used for internal messaging between collocated Uima AS services.boolean
isAwaitingCacheCallbackNotification()
boolean
isCasMultiplier()
boolean
isStopped()
Return true if this service is in the shutdown stateboolean
isTopLevelComponent()
protected void
logStats()
protected void
logStats(java.lang.String aDelegateKey, ServicePerformance aServicePerformance)
Logs statisticsvoid
notifyListenersWithInitializationStatus(java.lang.Exception e)
void
onCacheEmpty()
Callback method called the InProcessCache becomes empty meaning ALL CASes are processed.protected void
plugInDefaultErrorHandlerChain()
void
process(org.apache.uima.cas.CAS aCas, java.lang.String aCasId)
void
process(org.apache.uima.cas.CAS aCAS, java.lang.String anInputCasReferenceId, java.lang.String aNewCasReferenceId, java.lang.String newCASProducedBy)
void
process(org.apache.uima.cas.CAS aCAS, java.lang.String aCasReferenceId, Endpoint anEndpoint)
void
quiesceAndStop()
Stops input channel(s) and waits for CASes still in play to complete processing.protected void
registerServiceWithJMX(java.lang.String key_value_list, boolean remote)
void
registerVmQueueWithJMX(java.lang.Object o, java.lang.String aName)
protected void
registerWithAgent(java.lang.Object o, java.lang.String aName)
Register a component with a given name with JMX MBeanServervoid
releaseNextCas(java.lang.String casReferenceId)
void
removeControllerCallbackListener(ControllerCallbackListener aListener)
Removes named application listener.protected void
resetErrorCounter()
void
saveReplyTime(long snapshot, java.lang.String aKey)
void
saveTime(long aTime, java.lang.String aCasReferenceId, java.lang.String anEndpointName)
void
sendMetadata(Endpoint anEndpoint, org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData metadata)
void
setCasManager(AsynchAECasManager casManager)
void
setDeployDescriptor(java.lang.String aDeployDescriptor)
void
setErrorHandlerChain(ErrorHandlerChain errorHandlerChain)
void
setInputChannel(InputChannel anInputChannel)
void
setJmxManagement(JmxManagement aJmxManagement)
Override the default JmxManagervoid
setOutputChannel(OutputChannel outputChannel)
void
setStopped()
Called to set the state of the AnalysisEngineController to STOPPED.void
setUimaEEAdminContext(UimaEEAdminContext anAdminContext)
void
stop()
Stops input channel(s) and initiates a shutdown of all delegates ( if this is an aggregate ).void
stop(java.lang.Throwable cause, java.lang.String aCasReferenceId)
void
stopCasMultiplier(Delegate casMultiplier, java.lang.String aCasReferenceId)
void
stopCasMultipliers()
protected void
stopDelegateTimers()
protected void
stopInputChannel()
Stops a listener on the main input channelprotected void
stopInputChannels(int channelsToStop)
protected void
stopTransportLayer()
void
terminate()
Using a reference to its parent, propagates the terminate event to the top level controller.void
terminate(java.lang.Throwable cause, java.lang.String aCasReferenceId)
java.lang.String
toString()
Print the component name rather than the class name-
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
destroy, getCasManager, getLogger, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, initialize, setLogger, setMetaData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.uima.aae.controller.AnalysisEngineController
collectionProcessComplete, getControllerLatch, getMonitor, getServiceEndpointName, getServiceInfo, handleDelegateLifeCycleEvent, initialize, isPrimitive, onInitialize, sendMetadata, takeAction
-
-
-
-
Field Detail
-
NO_RECOVERY
public static final boolean NO_RECOVERY
- See Also:
- Constant Field Values
-
currentState
protected BaseAnalysisEngineController.ServiceState currentState
-
latch
protected volatile ControllerLatch latch
-
statsMap
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Long> statsMap
-
monitor
protected Monitor monitor
-
clientEndpoint
protected Endpoint clientEndpoint
-
parentController
protected AnalysisEngineController parentController
-
resourceSpecifier
protected org.apache.uima.resource.ResourceSpecifier resourceSpecifier
-
paramsMap
protected java.util.HashMap paramsMap
-
inputChannel
protected InputChannel inputChannel
-
errorHandlerChain
protected ErrorHandlerChain errorHandlerChain
-
errorCount
protected long errorCount
-
inputChannelList
protected java.util.List inputChannelList
-
inputChannelMap
protected java.util.concurrent.ConcurrentHashMap inputChannelMap
-
componentCasPoolSize
protected int componentCasPoolSize
-
replyTime
protected long replyTime
-
idleTime
protected long idleTime
-
serviceErrorMap
protected java.util.concurrent.ConcurrentHashMap serviceErrorMap
-
jmxContext
protected java.lang.String jmxContext
-
servicePerformance
protected ServicePerformance servicePerformance
-
serviceErrors
protected ServiceErrors serviceErrors
-
stopped
protected volatile boolean stopped
-
delegateKey
protected java.lang.String delegateKey
-
unregisteredDelegateList
protected java.util.List unregisteredDelegateList
-
allDelegatesAreRemote
protected volatile boolean allDelegatesAreRemote
-
controllerListeners
protected java.util.List controllerListeners
-
serviceInitialized
protected volatile boolean serviceInitialized
-
perCasStatistics
protected java.util.concurrent.ConcurrentHashMap perCasStatistics
-
syncObject
protected java.lang.Object syncObject
-
cmOutstandingCASes
protected java.util.concurrent.ConcurrentHashMap cmOutstandingCASes
-
finalStepMux
protected final java.lang.Object finalStepMux
-
transports
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,UimaTransport> transports
-
messageListeners
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,UimaMessageListener> messageListeners
-
localCache
protected LocalCache localCache
-
aeDescriptor
protected java.lang.String aeDescriptor
-
delegates
protected java.util.List<Delegate> delegates
-
callbackReceived
protected volatile boolean callbackReceived
-
callbackMonitor
protected java.lang.Object callbackMonitor
-
awaitingCacheCallbackNotification
protected volatile boolean awaitingCacheCallbackNotification
-
abortedCasesMap
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String> abortedCasesMap
-
processPid
protected java.lang.String processPid
-
deadClientDestinationMap
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String> deadClientDestinationMap
-
-
Constructor Detail
-
BaseAnalysisEngineController
public BaseAnalysisEngineController()
-
BaseAnalysisEngineController
public BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache) throws java.lang.Exception
- Throws:
java.lang.Exception
-
BaseAnalysisEngineController
public BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache, java.util.Map aDestinationMap) throws java.lang.Exception
- Throws:
java.lang.Exception
-
BaseAnalysisEngineController
public BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache, java.util.Map aDestinationMap, JmxManagement aJmxManagement) throws java.lang.Exception
- Throws:
java.lang.Exception
-
BaseAnalysisEngineController
public BaseAnalysisEngineController(AnalysisEngineController aParentController, int aComponentCasPoolSize, long anInitialCasHeapSize, java.lang.String anEndpointName, java.lang.String aDescriptor, AsynchAECasManager aCasManager, InProcessCache anInProcessCache, java.util.Map aDestinationMap, JmxManagement aJmxManagement) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
dumpState
public abstract void dumpState(java.lang.StringBuffer buffer, java.lang.String lbl1)
- Specified by:
dumpState
in interfaceAnalysisEngineController
-
getParentController
public AnalysisEngineController getParentController()
- Specified by:
getParentController
in interfaceAnalysisEngineController
-
getTransport
public UimaTransport getTransport(java.lang.String aKey) throws java.lang.Exception
- Specified by:
getTransport
in interfaceAnalysisEngineController
- Throws:
java.lang.Exception
-
getTransport
public UimaTransport getTransport(UimaAsContext asContext) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getTransport
public UimaTransport getTransport(UimaAsContext asContext, java.lang.String aKey) throws java.lang.Exception
- Specified by:
getTransport
in interfaceAnalysisEngineController
- Throws:
java.lang.Exception
-
initializeVMTransport
public void initializeVMTransport(int parentControllerReplyConsumerCount) throws java.lang.Exception
Initializes transport used for internal messaging between collocated Uima AS services.- Specified by:
initializeVMTransport
in interfaceAnalysisEngineController
- Throws:
java.lang.Exception
-
getUimaMessageListener
public UimaMessageListener getUimaMessageListener(java.lang.String aDelegateKey)
- Specified by:
getUimaMessageListener
in interfaceAnalysisEngineController
-
getJMXDomain
public java.lang.String getJMXDomain()
Get the domain for Uima JMX. The domain includes a fixed string plus the name of the top level component. All uima ee objects are rooted at this domain.- Specified by:
getJMXDomain
in interfaceAnalysisEngineController
-
getManagementInterface
public JmxManagement getManagementInterface()
- Specified by:
getManagementInterface
in interfaceAnalysisEngineController
-
getIndex
public int getIndex()
Returns a unique id for each component in the service hierarchy. The top level component's id is always = 0- Specified by:
getIndex
in interfaceAnalysisEngineController
-
getJmxContext
public java.lang.String getJmxContext()
This is called once during initialization to compute the position of the component in the JMX hierarchy and create a context path that will be used to register the component in the JMX registry.- Specified by:
getJmxContext
in interfaceAnalysisEngineController
-
registerWithAgent
protected void registerWithAgent(java.lang.Object o, java.lang.String aName)
Register a component with a given name with JMX MBeanServer- Parameters:
o
- - component to register with JMXaName
- - full jmx context name for the component
-
registerVmQueueWithJMX
public void registerVmQueueWithJMX(java.lang.Object o, java.lang.String aName) throws java.lang.Exception
- Specified by:
registerVmQueueWithJMX
in interfaceAnalysisEngineController
- Throws:
java.lang.Exception
-
registerServiceWithJMX
protected void registerServiceWithJMX(java.lang.String key_value_list, boolean remote)
-
cleanUp
protected void cleanUp() throws java.lang.Exception
- Throws:
java.lang.Exception
-
setJmxManagement
public void setJmxManagement(JmxManagement aJmxManagement)
Override the default JmxManager
-
isTopLevelComponent
public boolean isTopLevelComponent()
- Specified by:
isTopLevelComponent
in interfaceAnalysisEngineController
-
getComponentName
public java.lang.String getComponentName()
Returns the name of the component. The name comes from the analysis engine descriptor- Specified by:
getComponentName
in interfaceAnalysisEngineController
-
toString
public java.lang.String toString()
Print the component name rather than the class name- Overrides:
toString
in classjava.lang.Object
-
addServiceInfo
public void addServiceInfo(ServiceInfo aServiceInfo)
- Specified by:
addServiceInfo
in interfaceAnalysisEngineController
-
getServicePerformance
public ServicePerformance getServicePerformance()
- Specified by:
getServicePerformance
in interfaceAnalysisEngineController
-
getServiceErrors
public ServiceErrors getServiceErrors()
- Specified by:
getServiceErrors
in interfaceAnalysisEngineController
-
getChildUimaContext
public org.apache.uima.UimaContext getChildUimaContext(java.lang.String aDelegateEndpointName) throws java.lang.Exception
- Specified by:
getChildUimaContext
in interfaceAnalysisEngineController
- Throws:
java.lang.Exception
-
setInputChannel
public void setInputChannel(InputChannel anInputChannel) throws java.lang.Exception
- Specified by:
setInputChannel
in interfaceAnalysisEngineController
- Throws:
java.lang.Exception
-
addInputChannel
public void addInputChannel(InputChannel anInputChannel)
- Specified by:
addInputChannel
in interfaceAnalysisEngineController
-
getInputChannel
public InputChannel getInputChannel()
- Specified by:
getInputChannel
in interfaceAnalysisEngineController
-
dropCAS
public void dropCAS(org.apache.uima.cas.CAS aCAS)
- Specified by:
dropCAS
in interfaceAnalysisEngineController
-
saveReplyTime
public void saveReplyTime(long snapshot, java.lang.String aKey)
- Specified by:
saveReplyTime
in interfaceAnalysisEngineController
-
getReplyTime
public long getReplyTime()
- Specified by:
getReplyTime
in interfaceAnalysisEngineController
-
handleAction
protected void handleAction(java.lang.String anAction, java.lang.String anEndpoint, ErrorContext anErrorContext) throws java.lang.Exception
- Throws:
java.lang.Exception
-
forceTimeoutOnPendingCases
public void forceTimeoutOnPendingCases(java.lang.String key)
- Specified by:
forceTimeoutOnPendingCases
in interfaceAnalysisEngineController
-
plugInDefaultErrorHandlerChain
protected void plugInDefaultErrorHandlerChain()
-
setErrorHandlerChain
public void setErrorHandlerChain(ErrorHandlerChain errorHandlerChain)
-
getErrorHandlerChain
public ErrorHandlerChain getErrorHandlerChain()
- Specified by:
getErrorHandlerChain
in interfaceAnalysisEngineController
-
handleError
public void handleError(java.util.HashMap aMap, java.lang.Throwable e)
-
dropCAS
public void dropCAS(java.lang.String aCasReferenceId, boolean deleteCacheEntry)
- Specified by:
dropCAS
in interfaceAnalysisEngineController
-
saveTime
public void saveTime(long aTime, java.lang.String aCasReferenceId, java.lang.String anEndpointName)
- Specified by:
saveTime
in interfaceAnalysisEngineController
-
getTime
public long getTime(java.lang.String aCasReferenceId, java.lang.String anEndpointName)
- Specified by:
getTime
in interfaceAnalysisEngineController
-
resetErrorCounter
protected void resetErrorCounter()
-
incrementErrorCounter
protected void incrementErrorCounter()
-
exceedsThresholdWithinWindow
protected boolean exceedsThresholdWithinWindow(int threshold, long docCount, int windowSize)
-
getOutputChannel
public OutputChannel getOutputChannel()
- Specified by:
getOutputChannel
in interfaceAnalysisEngineController
-
setOutputChannel
public void setOutputChannel(OutputChannel outputChannel) throws java.lang.Exception
- Specified by:
setOutputChannel
in interfaceAnalysisEngineController
- Throws:
java.lang.Exception
-
getCasManagerWrapper
public AsynchAECasManager getCasManagerWrapper()
- Specified by:
getCasManagerWrapper
in interfaceAnalysisEngineController
-
setCasManager
public void setCasManager(AsynchAECasManager casManager)
- Specified by:
setCasManager
in interfaceAnalysisEngineController
-
getInProcessCache
public InProcessCache getInProcessCache()
- Specified by:
getInProcessCache
in interfaceAnalysisEngineController
-
getResourceSpecifier
protected org.apache.uima.resource.ResourceSpecifier getResourceSpecifier()
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceAnalysisEngineController
-
getKey
public java.lang.String getKey()
- Specified by:
getKey
in interfaceAnalysisEngineController
-
process
public void process(org.apache.uima.cas.CAS aCas, java.lang.String aCasId)
- Specified by:
process
in interfaceAnalysisEngineController
-
process
public void process(org.apache.uima.cas.CAS aCAS, java.lang.String anInputCasReferenceId, java.lang.String aNewCasReferenceId, java.lang.String newCASProducedBy)
- Specified by:
process
in interfaceAnalysisEngineController
-
process
public void process(org.apache.uima.cas.CAS aCAS, java.lang.String aCasReferenceId, Endpoint anEndpoint)
- Specified by:
process
in interfaceAnalysisEngineController
-
setUimaEEAdminContext
public void setUimaEEAdminContext(UimaEEAdminContext anAdminContext)
- Specified by:
setUimaEEAdminContext
in interfaceAnalysisEngineController
-
getUimaEEAdminContext
public UimaEEAdminContext getUimaEEAdminContext()
- Specified by:
getUimaEEAdminContext
in interfaceAnalysisEngineController
-
dropStats
public void dropStats(java.lang.String aCasReferenceId, java.lang.String anEndpointName)
Removes statistics from the global Map- Specified by:
dropStats
in interfaceAnalysisEngineController
-
logStats
protected void logStats()
-
getCasStatistics
public ServicePerformance getCasStatistics(java.lang.String aCasReferenceId)
Returns stats associated with a given CAS. A service uses a global map to store CAS level statistics. A key to the map is the CAS id. This method creates a new instance of ServicePerformance object if one doesnt exist in the map for a given CAS id.- Specified by:
getCasStatistics
in interfaceAnalysisEngineController
-
logStats
protected void logStats(java.lang.String aDelegateKey, ServicePerformance aServicePerformance)
Logs statistics- Parameters:
aDelegateKey
-aDelegateServicePerformance
-
-
clearStats
protected void clearStats()
Clears controller statistics.
-
getStats
public java.util.Map getStats()
Returns a copy of the controller statistics.- Specified by:
getStats
in interfaceAnalysisEngineController
-
setDeployDescriptor
public void setDeployDescriptor(java.lang.String aDeployDescriptor)
- Specified by:
setDeployDescriptor
in interfaceAnalysisEngineController
-
getServiceName
public java.lang.String getServiceName()
-
getDeploymentDescriptor
public java.lang.String getDeploymentDescriptor()
-
getDeploymentMode
public java.lang.String getDeploymentMode()
-
getBrokerURL
public java.lang.String getBrokerURL()
-
getInputQueue
public java.lang.String getInputQueue()
-
getTotalTimeSpentSerializingCAS
public long getTotalTimeSpentSerializingCAS()
-
getTotalTimeSpendDeSerializingCAS
public long getTotalTimeSpendDeSerializingCAS()
-
getTotalTimeSpentWaitingForFreeCASInstance
public long getTotalTimeSpentWaitingForFreeCASInstance()
-
getTotalNumberOfCASesReceived
public long getTotalNumberOfCASesReceived()
-
getTotalNumberOfCASesProcessed
public long getTotalNumberOfCASesProcessed()
-
getTotalNumberOfCASesDropped
public long getTotalNumberOfCASesDropped()
-
getTotalNumberOfErrors
public long getTotalNumberOfErrors()
-
getClientEndpoint
public Endpoint getClientEndpoint()
- Specified by:
getClientEndpoint
in interfaceAnalysisEngineController
-
cacheClientEndpoint
public void cacheClientEndpoint(Endpoint anEndpoint)
- Specified by:
cacheClientEndpoint
in interfaceAnalysisEngineController
- Parameters:
anEndpoint
-
-
isStopped
public boolean isStopped()
Return true if this service is in the shutdown state- Specified by:
isStopped
in interfaceAnalysisEngineController
- Returns:
- - true if stopped
-
setStopped
public void setStopped()
Description copied from interface:AnalysisEngineController
Called to set the state of the AnalysisEngineController to STOPPED. This method does not stop input or output channels.- Specified by:
setStopped
in interfaceAnalysisEngineController
-
stopTransportLayer
protected void stopTransportLayer()
-
stop
public void stop()
Stops input channel(s) and initiates a shutdown of all delegates ( if this is an aggregate ). At the end sends an Exception to the client and closes an output channel.- Specified by:
stop
in interfaceAnalysisEngineController
-
stop
public void stop(java.lang.Throwable cause, java.lang.String aCasReferenceId)
-
quiesceAndStop
public void quiesceAndStop()
Stops input channel(s) and waits for CASes still in play to complete processing. When the InProcessCache becomes empty, initiate the service shutdown.- Specified by:
quiesceAndStop
in interfaceAnalysisEngineController
-
stopDelegateTimers
protected void stopDelegateTimers()
-
terminate
public void terminate()
Using a reference to its parent, propagates the terminate event to the top level controller. Typically invoked, when the error handling detects excessive errors and action=terminate. The top level controller, stops its input channel and instructs a colocated Cas Multiplier (it it has one) to stop generating new CASes. It then registers self as a listener with the InProcessCache. The callback will be called when the InProcessCache becomes empty. Only then, the top level controller will call stop() on each of a delegates (if the top level is an aggregate).- Specified by:
terminate
in interfaceControllerLifecycle
-
terminate
public void terminate(java.lang.Throwable cause, java.lang.String aCasReferenceId)
-
stopCasMultipliers
public void stopCasMultipliers()
-
stopCasMultiplier
public void stopCasMultiplier(Delegate casMultiplier, java.lang.String aCasReferenceId)
-
stopInputChannel
protected void stopInputChannel()
Stops a listener on the main input channel
-
stopInputChannels
protected void stopInputChannels(int channelsToStop)
-
getCasMultiplierController
public AnalysisEngineController getCasMultiplierController(java.lang.String cmKey)
Aggregates have more than one Listener channel. This method stops all configured input channels this service is configured with.
-
getInputChannel
public InputChannel getInputChannel(java.lang.String anEndpointName)
- Specified by:
getInputChannel
in interfaceAnalysisEngineController
-
getReplyInputChannel
public InputChannel getReplyInputChannel(java.lang.String aDelegateKey)
- Specified by:
getReplyInputChannel
in interfaceAnalysisEngineController
-
onCacheEmpty
public void onCacheEmpty()
Callback method called the InProcessCache becomes empty meaning ALL CASes are processed. The callback is only active when the the top level component is in the process of shutting down.- Specified by:
onCacheEmpty
in interfaceEventSubscriber
-
getEventListener
public EventSubscriber getEventListener()
Returns interface via which this instance receives callbacks- Specified by:
getEventListener
in interfaceAnalysisEngineController
-
addControllerCallbackListener
public void addControllerCallbackListener(ControllerCallbackListener aListener)
Register one or more listeners through which the controller can send notification of events.- Specified by:
addControllerCallbackListener
in interfaceControllerLifecycle
- Parameters:
aListener
- - application listener object to register
-
removeControllerCallbackListener
public void removeControllerCallbackListener(ControllerCallbackListener aListener)
Removes named application listener.- Specified by:
removeControllerCallbackListener
in interfaceControllerLifecycle
- Parameters:
aListener
- - application listener to remove
-
notifyListenersWithInitializationStatus
public void notifyListenersWithInitializationStatus(java.lang.Exception e)
- Specified by:
notifyListenersWithInitializationStatus
in interfaceAnalysisEngineController
-
dropCasStatistics
protected void dropCasStatistics(java.lang.String aCasReferenceId)
-
isCasMultiplier
public boolean isCasMultiplier()
- Specified by:
isCasMultiplier
in interfaceAnalysisEngineController
-
releaseNextCas
public void releaseNextCas(java.lang.String casReferenceId)
- Specified by:
releaseNextCas
in interfaceAnalysisEngineController
-
beginProcess
public void beginProcess(int msgType)
- Specified by:
beginProcess
in interfaceAnalysisEngineController
-
endProcess
public void endProcess(int msgType)
- Specified by:
endProcess
in interfaceAnalysisEngineController
-
getIdleTimeBetweenProcessCalls
public long getIdleTimeBetweenProcessCalls(int msgType)
- Specified by:
getIdleTimeBetweenProcessCalls
in interfaceAnalysisEngineController
-
getIdleTime
public long getIdleTime()
- Specified by:
getIdleTime
in interfaceAnalysisEngineController
-
getCpuTime
public long getCpuTime()
Returns CPU Time with nanosecond precision (not nanosecond accuracy). If the OS/JVM does not support reporting the CPU Time, returns the wall clock time.- Specified by:
getCpuTime
in interfaceAnalysisEngineController
-
getAnalysisTime
public long getAnalysisTime()
Returns the total CPU time all processing threads spent in analysis. This method subtracts the serialization and de-serialization time from the total. If this service is an aggregate, the return time is a sum of CPU utilization in each colocated delegate.- Specified by:
getAnalysisTime
in interfaceAnalysisEngineController
-
incrementSerializationTime
public void incrementSerializationTime(long cpuTime)
Increments the time this thread spent in serialization of a CAS- Specified by:
incrementSerializationTime
in interfaceAnalysisEngineController
-
incrementDeserializationTime
public void incrementDeserializationTime(long cpuTime)
Increments the time this thread spent in deserialization of a CAS- Specified by:
incrementDeserializationTime
in interfaceAnalysisEngineController
-
sendMetadata
public void sendMetadata(Endpoint anEndpoint, org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData metadata)
-
getLocalCache
public LocalCache getLocalCache()
- Specified by:
getLocalCache
in interfaceAnalysisEngineController
-
addAbortedCasReferenceId
public void addAbortedCasReferenceId(java.lang.String aCasReferenceId)
- Specified by:
addAbortedCasReferenceId
in interfaceAnalysisEngineController
-
abortGeneratingCASes
protected boolean abortGeneratingCASes(java.lang.String aCasReferenceId)
Returns true if a given CAS id is in the list of aborted CASes.- Parameters:
aCasReferenceId
- - id of the current input CAS being processed- Returns:
- - true if the CAS is in the list of aborted CASes, false otherwise
-
isAwaitingCacheCallbackNotification
public boolean isAwaitingCacheCallbackNotification()
- Specified by:
isAwaitingCacheCallbackNotification
in interfaceAnalysisEngineController
-
changeState
public void changeState(BaseAnalysisEngineController.ServiceState state)
- Specified by:
changeState
in interfaceAnalysisEngineController
-
getState
public BaseAnalysisEngineController.ServiceState getState()
- Specified by:
getState
in interfaceAnalysisEngineController
-
getDeadClientMap
public java.util.Map<java.lang.String,java.lang.String> getDeadClientMap()
- Specified by:
getDeadClientMap
in interfaceAnalysisEngineController
-
-