|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.epl.metric.StatementMetricArray
public class StatementMetricArray
Holder for statement group's statement metrics.
Changes to StatementMetric instances must be done in a read-lock:
getRwLock.readLock.lock() metric = getAddMetric(index) metric.accountFor(cpu, wall, etc) getRwLock.readLock.unlock()
All other changes are done under write lock for this class.
This is a collection backed by an array that grows by 50% each time expanded, maintains a free/busy list of statement names, maintains an element number of last used element.
The flush operaton copies the complete array, thereby keeping array size. Statement names are only removed on the next flush.
Constructor Summary | |
---|---|
StatementMetricArray(java.lang.String engineURI,
java.lang.String name,
int initialSize,
boolean isReportInactive)
Ctor. |
Method Summary | |
---|---|
int |
addStatementGetIndex(java.lang.String statementName)
Adds a statement and returns the index added at. |
StatementMetric[] |
flushMetrics()
Flushes the existing metrics via array copy and swap. |
StatementMetric |
getAddMetric(int index)
Returns an existing or creates a new statement metric for the index. |
ManagedReadWriteLock |
getRwLock()
Returns the read-write lock, for read-lock when modifications are made. |
void |
removeStatement(java.lang.String statementName)
Remove a statement. |
int |
sizeLastElement()
Returns maximum collection size (last used element), which may not truely reflect the number of actual statements held as some slots may empty up when statements are removed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StatementMetricArray(java.lang.String engineURI, java.lang.String name, int initialSize, boolean isReportInactive)
engineURI
- engine URIname
- name of statement groupinitialSize
- initial size of arrayisReportInactive
- true to indicate to report on inactive statementsMethod Detail |
---|
public void removeStatement(java.lang.String statementName)
Next flush actually frees the slot that this statement occupied.
statementName
- to removepublic int addStatementGetIndex(java.lang.String statementName)
May reuse an empty slot, grow the underlying array, or append to the end.
statementName
- to add
public StatementMetric[] flushMetrics()
May report all statements (empty and non-empty slots) and thereby null values.
Returns null to indicate no reports to do.
public ManagedReadWriteLock getRwLock()
public StatementMetric getAddMetric(int index)
index
- of statement
public int sizeLastElement()
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |