twitter4j.management
Class APIStatistics

java.lang.Object
  extended by twitter4j.management.APIStatistics
All Implemented Interfaces:
APIStatisticsMBean, InvocationStatistics

public class APIStatistics
extends java.lang.Object
implements APIStatisticsMBean

Container for all InvocationStatisticsCalculators in a given API (like Twitter)

Author:
Nick Dellamaggiore (nick.dellamaggiore gmail.com)

Field Summary
private  InvocationStatisticsCalculator API_STATS_CALCULATOR
           
private  int HISTORY_SIZE
           
private  java.util.Map<java.lang.String,InvocationStatisticsCalculator> METHOD_STATS_MAP
           
 
Constructor Summary
APIStatistics(int historySize)
           
 
Method Summary
 long getAverageTime()
           
 long getCallCount()
           
 long getErrorCount()
           
 java.lang.Iterable<? extends InvocationStatistics> getInvocationStatistics()
           
 java.util.Map<java.lang.String,java.lang.String> getMethodLevelSummariesAsString()
           
 java.lang.String getMethodLevelSummary(java.lang.String methodName)
           
private  InvocationStatisticsCalculator getMethodStatistics(java.lang.String method)
           
 java.lang.String getName()
          APIStatisticsMBean implementation
 long getTotalTime()
           
 void methodCalled(java.lang.String method, long time, boolean success)
           
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

API_STATS_CALCULATOR

private final InvocationStatisticsCalculator API_STATS_CALCULATOR

METHOD_STATS_MAP

private final java.util.Map<java.lang.String,InvocationStatisticsCalculator> METHOD_STATS_MAP

HISTORY_SIZE

private final int HISTORY_SIZE
Constructor Detail

APIStatistics

public APIStatistics(int historySize)
Parameters:
historySize - the number of calls to track (for invocation time averaging)
Method Detail

methodCalled

public void methodCalled(java.lang.String method,
                         long time,
                         boolean success)
Parameters:
method - the method invoked
time - the method execution time

getMethodStatistics

private InvocationStatisticsCalculator getMethodStatistics(java.lang.String method)

getInvocationStatistics

public java.lang.Iterable<? extends InvocationStatistics> getInvocationStatistics()
Specified by:
getInvocationStatistics in interface APIStatisticsMBean

reset

public void reset()
Specified by:
reset in interface InvocationStatistics

getName

public java.lang.String getName()
APIStatisticsMBean implementation

Specified by:
getName in interface InvocationStatistics

getCallCount

public long getCallCount()
Specified by:
getCallCount in interface InvocationStatistics

getErrorCount

public long getErrorCount()
Specified by:
getErrorCount in interface InvocationStatistics

getTotalTime

public long getTotalTime()
Specified by:
getTotalTime in interface InvocationStatistics

getAverageTime

public long getAverageTime()
Specified by:
getAverageTime in interface InvocationStatistics

getMethodLevelSummariesAsString

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

getMethodLevelSummary

public java.lang.String getMethodLevelSummary(java.lang.String methodName)
Specified by:
getMethodLevelSummary in interface APIStatisticsMBean