net.sf.infrared.agent.jdbcstats
Class JDBCStatisticRepository

java.lang.Object
  extended bynet.sf.infrared.agent.jdbcstats.JDBCStatisticRepository
All Implemented Interfaces:
Serializable

public class JDBCStatisticRepository
extends Object
implements Serializable

This is the repository for storing the SQL statistics.

See Also:
Serialized Form

Constructor Summary
JDBCStatisticRepository()
           
 
Method Summary
 SqlStatistics[] getCopyOfSqlStatistics()
           
 Long getId(String sql)
          Returns the id associated with a sql string, if the sql is not already in the map it will add an entry to the map
 Map getIdToSqlMapCopy()
           
 double getPrepareExecuteRatio()
           
 String getSql(Long id)
           
 long getTotalTimeInJDBCLayer()
           
 void incrementNoOfExecutes()
           
 void incrementNoOfPrepares()
           
 IdMapper merge(JDBCStatisticRepository other)
           
 void recordExecuteError(Long id, long time, boolean prepared)
          Record a failed execute
 void recordExecuteSql(Long id, long time, boolean prepared)
          Record a call to execute a statement
 void recordFetchComplete(Long id, long noOfRowsFetched, long timeTakenForFetch)
           
 void recordPrepareSql(Long id, long time)
          Record a call to prepare a sql statement
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCStatisticRepository

public JDBCStatisticRepository()
Method Detail

recordPrepareSql

public void recordPrepareSql(Long id,
                             long time)
Record a call to prepare a sql statement

Parameters:
id - - id of the sql query
time - - time spent in preparing

recordExecuteSql

public void recordExecuteSql(Long id,
                             long time,
                             boolean prepared)
Record a call to execute a statement

Parameters:
id - - id of the sql query
time - - time spent in executing the query
prepared - - was it a prepared statement or plain statement

recordExecuteError

public void recordExecuteError(Long id,
                               long time,
                               boolean prepared)
Record a failed execute

Parameters:
id - - id of the sql query
time - - time spent in executing the query
prepared - - was it a prepared statement or plain statement

recordFetchComplete

public void recordFetchComplete(Long id,
                                long noOfRowsFetched,
                                long timeTakenForFetch)

getId

public Long getId(String sql)
Returns the id associated with a sql string, if the sql is not already in the map it will add an entry to the map

Parameters:
sql -
Returns:

incrementNoOfExecutes

public void incrementNoOfExecutes()

incrementNoOfPrepares

public void incrementNoOfPrepares()

getPrepareExecuteRatio

public double getPrepareExecuteRatio()

getTotalTimeInJDBCLayer

public long getTotalTimeInJDBCLayer()

getCopyOfSqlStatistics

public SqlStatistics[] getCopyOfSqlStatistics()

getSql

public String getSql(Long id)

reset

public void reset()

merge

public IdMapper merge(JDBCStatisticRepository other)

getIdToSqlMapCopy

public Map getIdToSqlMapCopy()