|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.services.instrumentation.statistics.DefaultStatisticsInterceptor.MethodStats
This inner class is used to track information about an individual method on a specific component. It is thread-safe by using thread-local to track the status of individual method calls from a single thread.
The two main methods are the start and stop method methods that begin and end the timing and tracking of the component method call. Failures, for a specific thread, are only detected apon the next call to the same method (within the same thread). This is the only way to track failures as the component system does not notify post listeners when there is a component failure.
Field Summary | |
private long |
callCount
Holds the number of times the method has been called. |
private long |
failures
Holds the number of times the method has failed. |
private Method |
method
Holds the method being instremented. |
private ThreadLocal |
methodCall
This thread local storage stores the start time of a method call in order to know when the call began. |
private long |
totalExecutionDuration
Holds the total execution duration for the method. |
Constructor Summary | |
DefaultStatisticsInterceptor.MethodStats(Method method)
Creates a new thread-safe method statistics tracking object. |
Method Summary | |
void |
endMethodCall(long time)
Ends the call tracking to the method, calculating the duration and reseting the thread-local storage for the next round of tracking. |
void |
fail()
Ends a call for the case of where the invocation failed. |
long |
getCallCount()
Gets the number of times the current method was called. |
long |
getFailures()
Gets the count of failures (exceptions thrown from) the component method being tracked. |
Method |
getMethod()
Returns the tracked method. |
long |
getTotalExecutionDuration()
Gets the total time in milleseconds spent in the tracked component. |
protected void |
setCallCount(long callCount)
|
protected void |
setFailures(long failures)
|
protected void |
setTotalExecutionDuration(long totalExecutionDuration)
|
void |
startMethodCall(long time)
Begins the method call tracking by placing the start time in a thread-local storage location. |
String |
toString()
Converts the object into a simple String representation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private Method method
private long callCount
private long failures
private long totalExecutionDuration
private final ThreadLocal methodCall
Constructor Detail |
public DefaultStatisticsInterceptor.MethodStats(Method method)
method
- The method object of the method being trackedMethod Detail |
public void startMethodCall(long time)
time
- the time in milleseconds that the method call beganpublic void fail()
public void endMethodCall(long time)
time
- the time in milleseconds that the method call endedpublic Method getMethod()
public long getCallCount()
public long getFailures()
public long getTotalExecutionDuration()
protected void setCallCount(long callCount)
protected void setFailures(long failures)
protected void setTotalExecutionDuration(long totalExecutionDuration)
public String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |