org.jboss.ejb3.statistics
Class InvocationStatistics

java.lang.Object
  extended by org.jboss.ejb3.statistics.InvocationStatistics
All Implemented Interfaces:
java.io.Serializable

public class InvocationStatistics
extends java.lang.Object
implements java.io.Serializable

A method invocation statistics collection class.

See Also:
Serialized Form

Nested Class Summary
 class InvocationStatistics.TimeStatistic
           
 
Field Summary
 java.util.concurrent.atomic.AtomicLong concurrentCalls
           
 long lastResetTime
           
 long maxConcurrentCalls
           
 
Constructor Summary
InvocationStatistics()
           
 
Method Summary
 void callIn()
           
 void callOut()
           
 java.util.Map<java.lang.String,InvocationStatistics.TimeStatistic> getStats()
          Accesses an immutable view of the current collection of method invocation statistics
 void resetStats()
          Resets all current TimeStatistics.
 java.lang.String toString()
          Generate an XML fragement for the InvocationStatistics.
 java.lang.String toXmlString()
           
 void updateStats(java.lang.reflect.Method m, long elapsed)
          Update the TimeStatistic for the given method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

concurrentCalls

public java.util.concurrent.atomic.AtomicLong concurrentCalls

maxConcurrentCalls

public volatile long maxConcurrentCalls

lastResetTime

public long lastResetTime
Constructor Detail

InvocationStatistics

public InvocationStatistics()
Method Detail

updateStats

public void updateStats(java.lang.reflect.Method m,
                        long elapsed)
Update the TimeStatistic for the given method. This synchronizes on this to ensure that the TimeStatistic for m is updated atomically.

Parameters:
m - the method to update the statistics for.
elapsed - the elapsed time in milliseconds for the invocation.

callIn

public void callIn()

callOut

public void callOut()

resetStats

public void resetStats()
Resets all current TimeStatistics.


getStats

public java.util.Map<java.lang.String,InvocationStatistics.TimeStatistic> getStats()
Accesses an immutable view of the current collection of method invocation statistics

Returns:
A HashMap of the method invocations

toString

public java.lang.String toString()
Generate an XML fragement for the InvocationStatistics. The format is ...

Overrides:
toString in class java.lang.Object
Returns:
an XML representation of the InvocationStatistics

toXmlString

public java.lang.String toXmlString()