org.apache.uima.aae.controller
Class BaseAnalysisEngineController

java.lang.Object
  extended by org.apache.uima.resource.Resource_ImplBase
      extended by 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
static class BaseAnalysisEngineController.ServiceState
           
 
Field Summary
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
 
Fields inherited from interface org.apache.uima.resource.Resource
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT
 
Constructor Summary
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
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(org.apache.uima.cas.CAS aCAS)
           
 void dropCAS(java.lang.String aCasReferenceId, boolean deleteCacheEntry)
           
protected  void dropCasStatistics(java.lang.String aCasReferenceId)
           
 void dropStats(java.lang.String aCasReferenceId, java.lang.String anEndpointName)
          Removes statistics from the global Map
abstract  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 callbacks
 long 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 CAS
protected  void incrementErrorCounter()
           
 void incrementSerializationTime(long cpuTime)
          Increments the time this thread spent in serialization of a CAS
 void 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 state
 boolean isTopLevelComponent()
           
protected  void logStats()
           
protected  void logStats(java.lang.String aDelegateKey, ServicePerformance aServicePerformance)
          Logs statistics
 void 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 aCasReferenceId, Endpoint anEndpoint)
           
 void process(org.apache.uima.cas.CAS aCAS, java.lang.String anInputCasReferenceId, java.lang.String aNewCasReferenceId, java.lang.String newCASProducedBy)
           
 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 MBeanServer
 void 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 JmxManager
 void 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 channel
protected  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, 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 interface AnalysisEngineController

getParentController

public AnalysisEngineController getParentController()
Specified by:
getParentController in interface AnalysisEngineController

getTransport

public UimaTransport getTransport(java.lang.String aKey)
                           throws java.lang.Exception
Specified by:
getTransport in interface AnalysisEngineController
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 interface AnalysisEngineController
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 interface AnalysisEngineController
Throws:
java.lang.Exception

getUimaMessageListener

public UimaMessageListener getUimaMessageListener(java.lang.String aDelegateKey)
Specified by:
getUimaMessageListener in interface AnalysisEngineController

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 interface AnalysisEngineController

getManagementInterface

public JmxManagement getManagementInterface()
Specified by:
getManagementInterface in interface AnalysisEngineController

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 interface AnalysisEngineController

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 interface AnalysisEngineController

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 JMX
aName - - 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 interface AnalysisEngineController
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 interface AnalysisEngineController

getComponentName

public java.lang.String getComponentName()
Returns the name of the component. The name comes from the analysis engine descriptor

Specified by:
getComponentName in interface AnalysisEngineController

toString

public java.lang.String toString()
Print the component name rather than the class name

Overrides:
toString in class java.lang.Object

addServiceInfo

public void addServiceInfo(ServiceInfo aServiceInfo)
Specified by:
addServiceInfo in interface AnalysisEngineController

getServicePerformance

public ServicePerformance getServicePerformance()
Specified by:
getServicePerformance in interface AnalysisEngineController

getServiceErrors

public ServiceErrors getServiceErrors()
Specified by:
getServiceErrors in interface AnalysisEngineController

getChildUimaContext

public org.apache.uima.UimaContext getChildUimaContext(java.lang.String aDelegateEndpointName)
                                                throws java.lang.Exception
Specified by:
getChildUimaContext in interface AnalysisEngineController
Throws:
java.lang.Exception

setInputChannel

public void setInputChannel(InputChannel anInputChannel)
                     throws java.lang.Exception
Specified by:
setInputChannel in interface AnalysisEngineController
Throws:
java.lang.Exception

addInputChannel

public void addInputChannel(InputChannel anInputChannel)
Specified by:
addInputChannel in interface AnalysisEngineController

getInputChannel

public InputChannel getInputChannel()
Specified by:
getInputChannel in interface AnalysisEngineController

dropCAS

public void dropCAS(org.apache.uima.cas.CAS aCAS)
Specified by:
dropCAS in interface AnalysisEngineController

saveReplyTime

public void saveReplyTime(long snapshot,
                          java.lang.String aKey)
Specified by:
saveReplyTime in interface AnalysisEngineController

getReplyTime

public long getReplyTime()
Specified by:
getReplyTime in interface AnalysisEngineController

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 interface AnalysisEngineController

plugInDefaultErrorHandlerChain

protected void plugInDefaultErrorHandlerChain()

setErrorHandlerChain

public void setErrorHandlerChain(ErrorHandlerChain errorHandlerChain)

getErrorHandlerChain

public ErrorHandlerChain getErrorHandlerChain()
Specified by:
getErrorHandlerChain in interface AnalysisEngineController

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 interface AnalysisEngineController

saveTime

public void saveTime(long aTime,
                     java.lang.String aCasReferenceId,
                     java.lang.String anEndpointName)
Specified by:
saveTime in interface AnalysisEngineController

getTime

public long getTime(java.lang.String aCasReferenceId,
                    java.lang.String anEndpointName)
Specified by:
getTime in interface AnalysisEngineController

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 interface AnalysisEngineController

setOutputChannel

public void setOutputChannel(OutputChannel outputChannel)
                      throws java.lang.Exception
Specified by:
setOutputChannel in interface AnalysisEngineController
Throws:
java.lang.Exception

getCasManagerWrapper

public AsynchAECasManager getCasManagerWrapper()
Specified by:
getCasManagerWrapper in interface AnalysisEngineController

setCasManager

public void setCasManager(AsynchAECasManager casManager)
Specified by:
setCasManager in interface AnalysisEngineController

getInProcessCache

public InProcessCache getInProcessCache()
Specified by:
getInProcessCache in interface AnalysisEngineController

getResourceSpecifier

protected org.apache.uima.resource.ResourceSpecifier getResourceSpecifier()

getName

public java.lang.String getName()
Specified by:
getName in interface AnalysisEngineController

getKey

public java.lang.String getKey()
Specified by:
getKey in interface AnalysisEngineController

process

public void process(org.apache.uima.cas.CAS aCas,
                    java.lang.String aCasId)
Specified by:
process in interface AnalysisEngineController

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 interface AnalysisEngineController

process

public void process(org.apache.uima.cas.CAS aCAS,
                    java.lang.String aCasReferenceId,
                    Endpoint anEndpoint)
Specified by:
process in interface AnalysisEngineController

setUimaEEAdminContext

public void setUimaEEAdminContext(UimaEEAdminContext anAdminContext)
Specified by:
setUimaEEAdminContext in interface AnalysisEngineController

getUimaEEAdminContext

public UimaEEAdminContext getUimaEEAdminContext()
Specified by:
getUimaEEAdminContext in interface AnalysisEngineController

dropStats

public void dropStats(java.lang.String aCasReferenceId,
                      java.lang.String anEndpointName)
Removes statistics from the global Map

Specified by:
dropStats in interface AnalysisEngineController

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 interface AnalysisEngineController

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 interface AnalysisEngineController

setDeployDescriptor

public void setDeployDescriptor(java.lang.String aDeployDescriptor)
Specified by:
setDeployDescriptor in interface AnalysisEngineController

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 interface AnalysisEngineController

cacheClientEndpoint

public void cacheClientEndpoint(Endpoint anEndpoint)
Specified by:
cacheClientEndpoint in interface AnalysisEngineController
Parameters:
anEndpoint -

isStopped

public boolean isStopped()
Return true if this service is in the shutdown state

Specified by:
isStopped in interface AnalysisEngineController
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 interface AnalysisEngineController

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 interface AnalysisEngineController

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 interface AnalysisEngineController

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 interface ControllerLifecycle

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 interface AnalysisEngineController

getReplyInputChannel

public InputChannel getReplyInputChannel(java.lang.String aDelegateKey)
Specified by:
getReplyInputChannel in interface AnalysisEngineController

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 interface EventSubscriber

getEventListener

public EventSubscriber getEventListener()
Returns interface via which this instance receives callbacks

Specified by:
getEventListener in interface AnalysisEngineController

addControllerCallbackListener

public void addControllerCallbackListener(ControllerCallbackListener aListener)
Register one or more listeners through which the controller can send notification of events.

Specified by:
addControllerCallbackListener in interface ControllerLifecycle
Parameters:
aListener - - application listener object to register

removeControllerCallbackListener

public void removeControllerCallbackListener(ControllerCallbackListener aListener)
Removes named application listener.

Specified by:
removeControllerCallbackListener in interface ControllerLifecycle
Parameters:
aListener - - application listener to remove

notifyListenersWithInitializationStatus

public void notifyListenersWithInitializationStatus(java.lang.Exception e)
Specified by:
notifyListenersWithInitializationStatus in interface AnalysisEngineController

dropCasStatistics

protected void dropCasStatistics(java.lang.String aCasReferenceId)

isCasMultiplier

public boolean isCasMultiplier()
Specified by:
isCasMultiplier in interface AnalysisEngineController

releaseNextCas

public void releaseNextCas(java.lang.String casReferenceId)
Specified by:
releaseNextCas in interface AnalysisEngineController

beginProcess

public void beginProcess(int msgType)
Specified by:
beginProcess in interface AnalysisEngineController

endProcess

public void endProcess(int msgType)
Specified by:
endProcess in interface AnalysisEngineController

getIdleTimeBetweenProcessCalls

public long getIdleTimeBetweenProcessCalls(int msgType)
Specified by:
getIdleTimeBetweenProcessCalls in interface AnalysisEngineController

getIdleTime

public long getIdleTime()
Specified by:
getIdleTime in interface AnalysisEngineController

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 interface AnalysisEngineController

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 interface AnalysisEngineController

incrementSerializationTime

public void incrementSerializationTime(long cpuTime)
Increments the time this thread spent in serialization of a CAS

Specified by:
incrementSerializationTime in interface AnalysisEngineController

incrementDeserializationTime

public void incrementDeserializationTime(long cpuTime)
Increments the time this thread spent in deserialization of a CAS

Specified by:
incrementDeserializationTime in interface AnalysisEngineController

sendMetadata

public void sendMetadata(Endpoint anEndpoint,
                         org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData metadata)

getLocalCache

public LocalCache getLocalCache()
Specified by:
getLocalCache in interface AnalysisEngineController

addAbortedCasReferenceId

public void addAbortedCasReferenceId(java.lang.String aCasReferenceId)
Specified by:
addAbortedCasReferenceId in interface AnalysisEngineController

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 interface AnalysisEngineController

changeState

public void changeState(BaseAnalysisEngineController.ServiceState state)
Specified by:
changeState in interface AnalysisEngineController

getState

public BaseAnalysisEngineController.ServiceState getState()
Specified by:
getState in interface AnalysisEngineController

getDeadClientMap

public java.util.Map<java.lang.String,java.lang.String> getDeadClientMap()
Specified by:
getDeadClientMap in interface AnalysisEngineController


Copyright © 2012. All Rights Reserved.