to.etc.dbpool.info
Class InfoCollectorExpenseBased

java.lang.Object
  extended by to.etc.dbpool.info.InfoCollectorBase
      extended by to.etc.dbpool.info.InfoCollectorExpenseBased
All Implemented Interfaces:
InfoCollector

public class InfoCollectorExpenseBased
extends InfoCollectorBase
implements InfoCollector

This collects per-statement execution time and collects statement counts.

Author:
Frits Jalvingh Created on Nov 3, 2010

Nested Class Summary
static class InfoCollectorExpenseBased.StmtCount
           
 
Field Summary
 
Fields inherited from class to.etc.dbpool.info.InfoCollectorBase
m_executeDuration, m_nConnectionAllocations, m_nErrors, m_nExecutes, m_nPreparedQueries, m_nPreparedUpdates, m_nPrepares, m_nRows, m_nStatementQueries, m_nStatementUpdates, m_nUpdatedRows, m_preparedQueryDuration, m_preparedUpdateDuration, m_prepareDuration, m_statementQueryDuration, m_statementUpdateDuration, m_totalFetchDuration
 
Constructor Summary
InfoCollectorExpenseBased(java.lang.String ident, java.lang.String queryString, boolean collectSQL)
           
 
Method Summary
 void addBatch(java.lang.String sql)
           
 void addPerformanceCollector(IPerformanceCollector pc)
           
 void connectionAllocated()
           
 void executeBatchEnd(StatementProxy sp, int[] rc)
           
 void executeBatchStart(StatementProxy sp)
           
 void executeEnd(StatementProxy sp, java.lang.Boolean result)
           
 void executeError(StatementProxy sp, java.lang.Exception x)
           
 void executePreparedQueryStart(StatementProxy sp)
           
 void executePreparedUpdateStart(StatementProxy sp)
           
 void executeQueryEnd(StatementProxy sp, ResultSetProxy rs)
           
 void executeQueryStart(StatementProxy sp)
           
 void executeStart(StatementProxy sp)
           
 void executeUpdateEnd(StatementProxy sp, int rowcount)
           
 void executeUpdateStart(StatementProxy sp)
           
<T extends IPerformanceCollector>
T
findCollector(java.lang.Class<T> clz)
           
 void finish()
          Called when the collector is removed from the set.
 java.util.List<InfoCollectorExpenseBased.StmtCount> getCounters()
           
 java.util.Map<java.lang.String,InfoCollectorExpenseBased.StmtCount> getStatementMap()
           
 void incrementUpdateCount(int uc)
           
 void prepareStatement(java.lang.String sql)
          Called when a prepare is started.
 void prepareStatementEnd(java.lang.String sql, StatementProxy sp)
          Called when the prepare call has finished.
 void reportSimple()
           
 void resultSetClosed(ResultSetProxy rp)
          The result set was closed, and row fetch count and row fetch duration is available.
 
Methods inherited from class to.etc.dbpool.info.InfoCollectorBase
getDuration, getExecuteDuration, getIdent, getNConnectionAllocations, getNErrors, getNExecutes, getNPreparedQueries, getNPreparedUpdates, getNPrepares, getNRows, getNStatementQueries, getNStatementUpdates, getNUpdatedRows, getPreparedQueryDuration, getPreparedUpdateDuration, getPrepareDuration, getStartTS, getStatementQueryDuration, getStatementUpdateDuration, getTotalDBRequests, getTotalFetchDuration, getTotalQueries, getTotalUpdates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InfoCollectorExpenseBased

public InfoCollectorExpenseBased(java.lang.String ident,
                                 java.lang.String queryString,
                                 boolean collectSQL)
Method Detail

addPerformanceCollector

public void addPerformanceCollector(IPerformanceCollector pc)

finish

public void finish()
Called when the collector is removed from the set. It should complete all data so that retrieval can be done.

Specified by:
finish in interface InfoCollector
See Also:
InfoCollector.finish()

getStatementMap

public java.util.Map<java.lang.String,InfoCollectorExpenseBased.StmtCount> getStatementMap()

getCounters

public java.util.List<InfoCollectorExpenseBased.StmtCount> getCounters()

findCollector

public <T extends IPerformanceCollector> T findCollector(java.lang.Class<T> clz)

connectionAllocated

public void connectionAllocated()
Specified by:
connectionAllocated in interface InfoCollector
See Also:
InfoCollector.connectionAllocated()

executeError

public void executeError(StatementProxy sp,
                         java.lang.Exception x)
Specified by:
executeError in interface InfoCollector

resultSetClosed

public void resultSetClosed(ResultSetProxy rp)
Description copied from interface: InfoCollector
The result set was closed, and row fetch count and row fetch duration is available.

Specified by:
resultSetClosed in interface InfoCollector

incrementUpdateCount

public void incrementUpdateCount(int uc)
Specified by:
incrementUpdateCount in interface InfoCollector

prepareStatement

public void prepareStatement(java.lang.String sql)
Description copied from interface: InfoCollector
Called when a prepare is started. This starts the clock for the statement.

Specified by:
prepareStatement in interface InfoCollector

prepareStatementEnd

public void prepareStatementEnd(java.lang.String sql,
                                StatementProxy sp)
Description copied from interface: InfoCollector
Called when the prepare call has finished.

Specified by:
prepareStatementEnd in interface InfoCollector

executePreparedQueryStart

public void executePreparedQueryStart(StatementProxy sp)
Specified by:
executePreparedQueryStart in interface InfoCollector

executeQueryStart

public void executeQueryStart(StatementProxy sp)
Specified by:
executeQueryStart in interface InfoCollector

executeQueryEnd

public void executeQueryEnd(StatementProxy sp,
                            ResultSetProxy rs)
Specified by:
executeQueryEnd in interface InfoCollector

executePreparedUpdateStart

public void executePreparedUpdateStart(StatementProxy sp)
Specified by:
executePreparedUpdateStart in interface InfoCollector

executeUpdateStart

public void executeUpdateStart(StatementProxy sp)
Specified by:
executeUpdateStart in interface InfoCollector

executeUpdateEnd

public void executeUpdateEnd(StatementProxy sp,
                             int rowcount)
Specified by:
executeUpdateEnd in interface InfoCollector

executeStart

public void executeStart(StatementProxy sp)
Specified by:
executeStart in interface InfoCollector

executeEnd

public void executeEnd(StatementProxy sp,
                       java.lang.Boolean result)
Specified by:
executeEnd in interface InfoCollector

executeBatchEnd

public void executeBatchEnd(StatementProxy sp,
                            int[] rc)
Specified by:
executeBatchEnd in interface InfoCollector

executeBatchStart

public void executeBatchStart(StatementProxy sp)
Specified by:
executeBatchStart in interface InfoCollector

addBatch

public void addBatch(java.lang.String sql)
Specified by:
addBatch in interface InfoCollector

reportSimple

public void reportSimple()