net.ttddyy.dsproxy.listener
Class DataSourceQueryCountListener

java.lang.Object
  extended by net.ttddyy.dsproxy.listener.DataSourceQueryCountListener
All Implemented Interfaces:
QueryExecutionListener

public class DataSourceQueryCountListener
extends Object
implements QueryExecutionListener

Update database access information to thread local value(QueryCount).

In web application lifecycle, one http request is handled by one thread. Storing database access information into a thread local value provides metrics information per http request.

Thread local value(QueryCount) holds following information. - datasource name - number of database call - total query execution time - number of queries by type

QueryCount can be retrieved by QueryCountHolder.get(String).

Author:
Tadaya Tsuyukubo
See Also:
QueryCount, QueryCountHolder, CommonsQueryCountLoggingFilter, CommonsQueryCountLoggingRequestListener, CommonsQueryCountLoggingHandlerInterceptor

Constructor Summary
DataSourceQueryCountListener()
           
 
Method Summary
 void afterQuery(ExecutionInfo execInfo, List<QueryInfo> queryInfoList)
           
 void beforeQuery(ExecutionInfo execInfo, List<QueryInfo> queryInfoList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSourceQueryCountListener

public DataSourceQueryCountListener()
Method Detail

beforeQuery

public void beforeQuery(ExecutionInfo execInfo,
                        List<QueryInfo> queryInfoList)
Specified by:
beforeQuery in interface QueryExecutionListener

afterQuery

public void afterQuery(ExecutionInfo execInfo,
                       List<QueryInfo> queryInfoList)
Specified by:
afterQuery in interface QueryExecutionListener


Copyright © 2012. All Rights Reserved.