net.sf.infrared.agent.util
Class MultipleEntryGaurd

java.lang.Object
  extended bynet.sf.infrared.agent.util.MultipleEntryGaurd
All Implemented Interfaces:
MonitorFacade

public class MultipleEntryGaurd
extends Object
implements MonitorFacade

This class is used to detect/prevent calls to InfraRED while we are in the processs of executing InfraRED code, this can happen if one of the libraries that InfraRED depends (e.g. Log4J) on is instrumented


Constructor Summary
MultipleEntryGaurd(MonitorFacade delegate)
           
 
Method Summary
 void endRequest()
          This method is called by the monitoring filter to indicate that the processing of a request has ended.
 MonitorConfig getConfiguration()
          Get the configuration object associated with this monitoring kit
 long getNumberOfCalls()
           
 long getOverhead()
           
 long getPruneBelowTime()
           
 boolean isCallTracingEnabled()
           
 boolean isCollectFetchDataEnabled()
           
 boolean isJDBCMonitoringEnabled()
           
 boolean isMonitoringEnabled()
           
 void recordExecuteError(String sql, long time, boolean prepared)
          Record a failed execute
 void recordExecuteSql(String sql, long time, boolean prepared)
          Record a call to execute a statement
 void recordFetchComplete(String query, long noOfRowsFetched, long timeTakenForFetch)
          This method is called to indicate a completion of a fetch.
 void recordHTTPRequest(String request, long execTime)
          This method is called to record the time for a HTTP request
 void recordMethodBegin(Class declaringType, String methodName, String apiType)
          Call-back method used by monitoring aspects to indicate that a method execution has started.
 void recordMethodBegin(Class declaringType, String methodName, String apiType, String componentName, ApiContext context)
          Call-back method used by monitoring aspects to indicate that a method execution has started.
 void recordMethodCall(Class declaringType, String methodName, String apiType, String componentName, ApiContext context, long time)
          Record a method call timing
 void recordMethodEnd(Class declaringType, String methodName, String apiType)
          Call-back method for monitoring aspects to indicate that a method execution has stopped.
 void recordMethodEnd(Class declaringType, String methodName, String apiType, String componentName, ApiContext context)
          Call-back method for monitoring aspects to indicate that a method execution has stopped.
 void recordMethodTime(Class declaringType, String methodName, String apiType, long time)
          Record a method call timing
 void recordPrepareSql(String sql, long time)
          Record a call to prepare a sql statement
 void recordResourceLeak(String resourceName, StackTraceElement[] acquisitionLocation)
          This method is called to record a Resource leak
 void startRequest()
          This method is called by the monitoring filter to indicate that the processing of a request has been started
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleEntryGaurd

public MultipleEntryGaurd(MonitorFacade delegate)
Method Detail

recordMethodBegin

public void recordMethodBegin(Class declaringType,
                              String methodName,
                              String apiType)
Description copied from interface: MonitorFacade
Call-back method used by monitoring aspects to indicate that a method execution has started.
Starts monitoring for a specified method, in the specified class of the specified API type.

Specified by:
recordMethodBegin in interface MonitorFacade
Parameters:
declaringType -
methodName -
apiType -

recordMethodBegin

public void recordMethodBegin(Class declaringType,
                              String methodName,
                              String apiType,
                              String componentName,
                              ApiContext context)
Description copied from interface: MonitorFacade
Call-back method used by monitoring aspects to indicate that a method execution has started.
Starts monitoring for a specified method, called with specified arguments, in the specified class. This overloaded variant is used by aspects written by component authors who want to use to InfraRED infrastructure. The name of the component and a context information is also passed.

Specified by:
recordMethodBegin in interface MonitorFacade
Parameters:
declaringType -
methodName -
apiType -
componentName -
context -

recordMethodEnd

public void recordMethodEnd(Class declaringType,
                            String methodName,
                            String apiType)
Description copied from interface: MonitorFacade
Call-back method for monitoring aspects to indicate that a method execution has stopped. Stops monitoring the specified method in the specified class.

Specified by:
recordMethodEnd in interface MonitorFacade
Parameters:
declaringType -
methodName -
apiType -

recordMethodEnd

public void recordMethodEnd(Class declaringType,
                            String methodName,
                            String apiType,
                            String componentName,
                            ApiContext context)
Description copied from interface: MonitorFacade
Call-back method for monitoring aspects to indicate that a method execution has stopped.
Stops monitoring the specified method in the specified class. This overloaded variant is used by aspects written by component authors who want to use to InfraRED infrastructure. The name of the component and a context information is also passed.

Specified by:
recordMethodEnd in interface MonitorFacade
Parameters:
declaringType -
methodName -
apiType -
componentName -
context -

isMonitoringEnabled

public boolean isMonitoringEnabled()
Specified by:
isMonitoringEnabled in interface MonitorFacade

recordMethodTime

public void recordMethodTime(Class declaringType,
                             String methodName,
                             String apiType,
                             long time)
Description copied from interface: MonitorFacade
Record a method call timing

Specified by:
recordMethodTime in interface MonitorFacade
Parameters:
declaringType -
methodName -
apiType -
time -

recordMethodCall

public void recordMethodCall(Class declaringType,
                             String methodName,
                             String apiType,
                             String componentName,
                             ApiContext context,
                             long time)
Description copied from interface: MonitorFacade
Record a method call timing

Specified by:
recordMethodCall in interface MonitorFacade
Parameters:
declaringType -
methodName -
apiType -
componentName -
context -
time -

recordPrepareSql

public void recordPrepareSql(String sql,
                             long time)
Description copied from interface: MonitorFacade
Record a call to prepare a sql statement

Specified by:
recordPrepareSql in interface MonitorFacade
Parameters:
sql - - sql query
time - - time spent in preparing

recordExecuteSql

public void recordExecuteSql(String sql,
                             long time,
                             boolean prepared)
Description copied from interface: MonitorFacade
Record a call to execute a statement

Specified by:
recordExecuteSql in interface MonitorFacade
Parameters:
sql - - sql query
time - - time spent in executing the query
prepared - - was it a prepared statement or plain statement

recordExecuteError

public void recordExecuteError(String sql,
                               long time,
                               boolean prepared)
Description copied from interface: MonitorFacade
Record a failed execute

Specified by:
recordExecuteError in interface MonitorFacade
Parameters:
sql - - sql query
time - - time spent in executing the query
prepared - - was it a prepared statement or plain statement

recordFetchComplete

public void recordFetchComplete(String query,
                                long noOfRowsFetched,
                                long timeTakenForFetch)
Description copied from interface: MonitorFacade
This method is called to indicate a completion of a fetch.

Specified by:
recordFetchComplete in interface MonitorFacade
Parameters:
query - - sql whose results were fetched
noOfRowsFetched - - total number of rows fetched
timeTakenForFetch - - time taken to fetch

recordHTTPRequest

public void recordHTTPRequest(String request,
                              long execTime)
Description copied from interface: MonitorFacade
This method is called to record the time for a HTTP request

Specified by:
recordHTTPRequest in interface MonitorFacade
Parameters:
request -
execTime -

startRequest

public void startRequest()
Description copied from interface: MonitorFacade
This method is called by the monitoring filter to indicate that the processing of a request has been started

Specified by:
startRequest in interface MonitorFacade

endRequest

public void endRequest()
Description copied from interface: MonitorFacade
This method is called by the monitoring filter to indicate that the processing of a request has ended.

Specified by:
endRequest in interface MonitorFacade

recordResourceLeak

public void recordResourceLeak(String resourceName,
                               StackTraceElement[] acquisitionLocation)
Description copied from interface: MonitorFacade
This method is called to record a Resource leak

Specified by:
recordResourceLeak in interface MonitorFacade
Parameters:
resourceName - - identified the type of resource (Connection, Statement etc)
acquisitionLocation - - The stack trace pointing to the location of aquisition.

getConfiguration

public MonitorConfig getConfiguration()
Description copied from interface: MonitorFacade
Get the configuration object associated with this monitoring kit

Specified by:
getConfiguration in interface MonitorFacade
Returns:

isJDBCMonitoringEnabled

public boolean isJDBCMonitoringEnabled()
Specified by:
isJDBCMonitoringEnabled in interface MonitorFacade

isCollectFetchDataEnabled

public boolean isCollectFetchDataEnabled()
Specified by:
isCollectFetchDataEnabled in interface MonitorFacade

isCallTracingEnabled

public boolean isCallTracingEnabled()
Specified by:
isCallTracingEnabled in interface MonitorFacade

getPruneBelowTime

public long getPruneBelowTime()
Specified by:
getPruneBelowTime in interface MonitorFacade

getOverhead

public long getOverhead()

getNumberOfCalls

public long getNumberOfCalls()