Class AnalysisEngineManagementImpl
- java.lang.Object
-
- org.apache.uima.analysis_engine.impl.AnalysisEngineManagementImpl
-
- All Implemented Interfaces:
java.io.Serializable
,AnalysisEngineManagement
,AnalysisEngineManagementImplMBean
,ManagementObject
public class AnalysisEngineManagementImpl extends java.lang.Object implements AnalysisEngineManagementImplMBean, AnalysisEngineManagement
Implements Monitoring/Management interface to an AnalysisEngine.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.uima.analysis_engine.AnalysisEngineManagement
AnalysisEngineManagement.State
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicLong
analysisTime
private java.util.concurrent.atomic.AtomicLong
batchProcessCompleteTime
private java.util.concurrent.atomic.AtomicLong
collectionProcessCompleteTime
private java.util.Map<java.lang.String,AnalysisEngineManagement>
components
(package private) static java.text.DecimalFormat
format
private long
initializationTime
private java.util.concurrent.atomic.AtomicLong
markedAnalysisTime
private java.util.concurrent.atomic.AtomicLong
markedBatchProcessCompleteTime
private java.util.concurrent.atomic.AtomicLong
markedCollectionProcessCompleteTime
private java.util.concurrent.atomic.AtomicLong
markedServiceCallTime
private java.lang.String
name
private java.util.concurrent.atomic.AtomicLong
numProcessed
private static java.util.concurrent.Callable<java.util.concurrent.atomic.AtomicInteger>
produceAtomicInteger
private static java.util.regex.Pattern
RESERVED_CHAR_PATTERN
private static long
serialVersionUID
private java.util.concurrent.atomic.AtomicLong
serviceCallTime
private AnalysisEngineManagement.State
status
private long
threadId
private java.lang.String
uniqueMBeanName
private static ConcurrentHashMapWithProducer<java.lang.String,java.util.concurrent.atomic.AtomicInteger>
usedRootNames
This static set is needed to keep track of what names we've already used for "root" MBeans (those representing top-level AEs and CPEs).
-
Constructor Summary
Constructors Constructor Description AnalysisEngineManagementImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addComponent(java.lang.String key, AnalysisEngineManagementImpl component)
private static java.lang.String
escapeValue(java.lang.String value)
Escapes the "value" part of a JMX name if necessary.long
getAnalysisTime()
Gets the total time this AnalysisEngine has spent doing analysis over its entire lifetime.long
getAnalysisTimeSinceMark()
Internal use only.long
getBatchProcessCompleteTime()
Gets the total time this AnalysisEngine has spent in its batchProcessComplete method over its entire lifetime.long
getBatchProcessCompleteTimeSinceMark()
Internal use only.java.lang.String
getCASesPerSecond()
Gets the throughput of this AnalysisEngine, represented as number of CASes processed per second.long
getCollectionProcessCompleteTime()
Gets the total time this AnalysisEngine has spent in its collectionProcessComplete method over its entire lifetime.long
getCollectionProcessCompleteTimeSinceMark()
Internal use only.java.util.Map<java.lang.String,AnalysisEngineManagement>
getComponents()
For an Aggregate AnalysisEngine, gets a Map whose values are AnalysisEngineManagement objects that contain the statistics for the components of the aggregate.long
getInitializationTime()
Total time it took AnalysisEngine to initializejava.lang.String
getName()
Gets a name for this AnalysisEngineManagement object, which will be unique among all of its siblings (i.e.long
getNumberOfCASesProcessed()
Gets the total number of CASes this AnalysisEngine has processed over its lifetime.(package private) static java.lang.String
getRootName(java.lang.String baseRootName)
long
getServiceCallTime()
If this AnalysisEngine is a proxy to a remote service, gets the total time spent making calls on that service.long
getServiceCallTimeSinceMark()
Internal use only.java.lang.String
getState()
Gets the current state of an AnalysisEngine.long
getThreadId()
Gets an id of a thread that was used to initialize AE instancejava.lang.String
getUniqueMBeanName()
Gets a valid JMX MBean name that is unique among all ManagementObjects in this JVM.void
incrementCASesProcessed()
private static java.lang.String
makeMBeanName(java.lang.String prefix, java.lang.String contextName, int depth)
Recursive utility method for generating a hierarchical mbean namevoid
mark()
Internal use only.void
reportAnalysisTime(long time)
void
reportBatchProcessCompleteTime(long time)
void
reportCollectionProcessCompleteTime(long time)
void
reportServiceCallTime(long time)
void
resetStats()
Resets all of the performance statistics to zero.void
setInitializationTime(long initializationTime)
void
setName(java.lang.String aName, UimaContextAdmin aContext, java.lang.String aCustomPrefix)
Sets the name of this AnalyaisEngineManagement object, and also computes the unique MBean name that can later be used to register this object with an MBeanServer.void
setState(AnalysisEngineManagement.State state)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
RESERVED_CHAR_PATTERN
private static final java.util.regex.Pattern RESERVED_CHAR_PATTERN
-
format
static final java.text.DecimalFormat format
-
usedRootNames
private static final ConcurrentHashMapWithProducer<java.lang.String,java.util.concurrent.atomic.AtomicInteger> usedRootNames
This static set is needed to keep track of what names we've already used for "root" MBeans (those representing top-level AEs and CPEs).
-
name
private java.lang.String name
-
numProcessed
private final java.util.concurrent.atomic.AtomicLong numProcessed
-
markedAnalysisTime
private final java.util.concurrent.atomic.AtomicLong markedAnalysisTime
-
markedBatchProcessCompleteTime
private final java.util.concurrent.atomic.AtomicLong markedBatchProcessCompleteTime
-
markedCollectionProcessCompleteTime
private final java.util.concurrent.atomic.AtomicLong markedCollectionProcessCompleteTime
-
markedServiceCallTime
private final java.util.concurrent.atomic.AtomicLong markedServiceCallTime
-
analysisTime
private final java.util.concurrent.atomic.AtomicLong analysisTime
-
batchProcessCompleteTime
private final java.util.concurrent.atomic.AtomicLong batchProcessCompleteTime
-
collectionProcessCompleteTime
private final java.util.concurrent.atomic.AtomicLong collectionProcessCompleteTime
-
serviceCallTime
private final java.util.concurrent.atomic.AtomicLong serviceCallTime
-
components
private final java.util.Map<java.lang.String,AnalysisEngineManagement> components
-
uniqueMBeanName
private java.lang.String uniqueMBeanName
-
status
private AnalysisEngineManagement.State status
-
threadId
private long threadId
-
initializationTime
private long initializationTime
-
produceAtomicInteger
private static final java.util.concurrent.Callable<java.util.concurrent.atomic.AtomicInteger> produceAtomicInteger
-
-
Method Detail
-
getInitializationTime
public long getInitializationTime()
Description copied from interface:AnalysisEngineManagement
Total time it took AnalysisEngine to initialize- Specified by:
getInitializationTime
in interfaceAnalysisEngineManagement
- Specified by:
getInitializationTime
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- - initialization time
-
setInitializationTime
public void setInitializationTime(long initializationTime)
-
getThreadId
public long getThreadId()
Description copied from interface:AnalysisEngineManagement
Gets an id of a thread that was used to initialize AE instance- Specified by:
getThreadId
in interfaceAnalysisEngineManagement
- Specified by:
getThreadId
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- - thread id
-
getState
public java.lang.String getState()
Description copied from interface:AnalysisEngineManagement
Gets the current state of an AnalysisEngine. The AE should either be in Initializing or Ready state.- Specified by:
getState
in interfaceAnalysisEngineManagement
- Specified by:
getState
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- the state of the analysis engine, from the State enum above
-
setState
public void setState(AnalysisEngineManagement.State state)
-
reportAnalysisTime
public void reportAnalysisTime(long time)
-
reportBatchProcessCompleteTime
public void reportBatchProcessCompleteTime(long time)
-
reportCollectionProcessCompleteTime
public void reportCollectionProcessCompleteTime(long time)
-
reportServiceCallTime
public void reportServiceCallTime(long time)
-
incrementCASesProcessed
public void incrementCASesProcessed()
-
getBatchProcessCompleteTime
public long getBatchProcessCompleteTime()
Description copied from interface:AnalysisEngineManagement
Gets the total time this AnalysisEngine has spent in its batchProcessComplete method over its entire lifetime.- Specified by:
getBatchProcessCompleteTime
in interfaceAnalysisEngineManagement
- Specified by:
getBatchProcessCompleteTime
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- the batch process complete time in milliseconds
-
getCollectionProcessCompleteTime
public long getCollectionProcessCompleteTime()
Description copied from interface:AnalysisEngineManagement
Gets the total time this AnalysisEngine has spent in its collectionProcessComplete method over its entire lifetime.- Specified by:
getCollectionProcessCompleteTime
in interfaceAnalysisEngineManagement
- Specified by:
getCollectionProcessCompleteTime
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- the batch process complete time in milliseconds
-
getAnalysisTime
public long getAnalysisTime()
Description copied from interface:AnalysisEngineManagement
Gets the total time this AnalysisEngine has spent doing analysis over its entire lifetime. This includes calls to theAnalysisEngine.process(CAS)
andAnalysisEngine.processAndOutputNewCASes(CAS)
methods, as well as calls to the CasIterator returned from the processAndOutputNewCASes method.- Specified by:
getAnalysisTime
in interfaceAnalysisEngineManagement
- Specified by:
getAnalysisTime
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- the analysis time time in milliseconds
-
getServiceCallTime
public long getServiceCallTime()
Description copied from interface:AnalysisEngineManagement
If this AnalysisEngine is a proxy to a remote service, gets the total time spent making calls on that service.- Specified by:
getServiceCallTime
in interfaceAnalysisEngineManagement
- Specified by:
getServiceCallTime
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- the service call time in milliseconds, or 0 if this AnalysisEngine is not a proxy to a service
-
mark
public void mark()
Internal use only. Used to implement backwards compatibility with the ProcessTrace interface.
-
getBatchProcessCompleteTimeSinceMark
public long getBatchProcessCompleteTimeSinceMark()
Internal use only. Used to implement backwards compatibility with the ProcessTrace interface.- Returns:
- Batch Process Complete time since mark
-
getCollectionProcessCompleteTimeSinceMark
public long getCollectionProcessCompleteTimeSinceMark()
Internal use only. Used to implement backwards compatibility with the ProcessTrace interface.- Returns:
- Collection Process Complete time since mark
-
getAnalysisTimeSinceMark
public long getAnalysisTimeSinceMark()
Internal use only. Used to implement backwards compatibility with the ProcessTrace interface.- Returns:
- Analysis time since mark
-
getServiceCallTimeSinceMark
public long getServiceCallTimeSinceMark()
Internal use only. Used to implement backwards compatibility with the ProcessTrace interface.- Returns:
- service call time since mark
-
getNumberOfCASesProcessed
public long getNumberOfCASesProcessed()
Description copied from interface:AnalysisEngineManagement
Gets the total number of CASes this AnalysisEngine has processed over its lifetime. For a CAS Multipliers, this includes both input and output CASes.- Specified by:
getNumberOfCASesProcessed
in interfaceAnalysisEngineManagement
- Specified by:
getNumberOfCASesProcessed
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- the number of CASes processed
-
getCASesPerSecond
public java.lang.String getCASesPerSecond()
Description copied from interface:AnalysisEngineManagement
Gets the throughput of this AnalysisEngine, represented as number of CASes processed per second.- Specified by:
getCASesPerSecond
in interfaceAnalysisEngineManagement
- Specified by:
getCASesPerSecond
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- a string representation of the throughput
-
getComponents
public java.util.Map<java.lang.String,AnalysisEngineManagement> getComponents()
Description copied from interface:AnalysisEngineManagement
For an Aggregate AnalysisEngine, gets a Map whose values are AnalysisEngineManagement objects that contain the statistics for the components of the aggregate. The keys in the Map are the unique String keys specified in the aggregate AnalysisEngine descriptor. If this AnalysisEngine is a primitive, returns an empty Map.- Specified by:
getComponents
in interfaceAnalysisEngineManagement
- Returns:
- a map from String keys to AnalysisEngineManagement objects
-
addComponent
public void addComponent(java.lang.String key, AnalysisEngineManagementImpl component)
-
getName
public java.lang.String getName()
Description copied from interface:AnalysisEngineManagement
Gets a name for this AnalysisEngineManagement object, which will be unique among all of its siblings (i.e. the objects returned from its parent'sAnalysisEngineManagement.getComponents()
method.- Specified by:
getName
in interfaceAnalysisEngineManagement
- Specified by:
getName
in interfaceAnalysisEngineManagementImplMBean
- Returns:
- a name for this AnalysisEngineManagement object
-
getUniqueMBeanName
public java.lang.String getUniqueMBeanName()
Description copied from interface:ManagementObject
Gets a valid JMX MBean name that is unique among all ManagementObjects in this JVM. (Technically, it is unique only among ManagementObjects objects loaded by the same ClassLoader, which is whatever ClassLoader was used to load the UIMA Framework classes.)If you are running with JRE 1.5, this is the name used to register this object with the platform MBeanServer.
- Specified by:
getUniqueMBeanName
in interfaceManagementObject
- Returns:
- a unique MBean name
-
resetStats
public void resetStats()
Description copied from interface:AnalysisEngineManagement
Resets all of the performance statistics to zero. For an Aggregate Analysis Engine, also resets the statistics for all the components of the aggregate.- Specified by:
resetStats
in interfaceAnalysisEngineManagement
- Specified by:
resetStats
in interfaceAnalysisEngineManagementImplMBean
-
setName
public void setName(java.lang.String aName, UimaContextAdmin aContext, java.lang.String aCustomPrefix)
Sets the name of this AnalyaisEngineManagement object, and also computes the unique MBean name that can later be used to register this object with an MBeanServer.- Parameters:
aName
- the simple name of this AnalysisEngine (generally this is thename
property from the AnalysisEngineMetaData)aContext
- the UimaContext for this AnalysisEngine. Needed to compute the unique name, which is hierarchicalaCustomPrefix
- an optional prefix provided by the Application, which will be prepended to the name generated by UIMA. If null, the prefix "org.apache.uima:" will be used.
-
getRootName
static java.lang.String getRootName(java.lang.String baseRootName)
- Parameters:
baseRootName
-- Returns:
- the baseRootName (or CPE if null) plus a suffix 2, 3, ... to be unique
-
makeMBeanName
private static java.lang.String makeMBeanName(java.lang.String prefix, java.lang.String contextName, int depth)
Recursive utility method for generating a hierarchical mbean name
-
escapeValue
private static java.lang.String escapeValue(java.lang.String value)
Escapes the "value" part of a JMX name if necessary. If the value includes reserved characters (" , = : * ?) the value will be enclosed in quotes and some characters (" ? * \) will be escaped with backslashes.
-
-