JProfiler API

com.jprofiler.api.agent.interceptor
Interface PayloadInfo


public interface PayloadInfo

A payload info represents a verbose description that can be added added to the current call stack together with associated timing information. Payload infos are created with factory methods in the interceptor class and can have optional memento objects that help you keep additonal state if the payload info is handled in different contexts, such as interception entry and interception exit.

A typical example for payload is the SQL string that is displayed by the built-in JDBC service call measurement.

See Also:
Interceptor.createPayloadInfo(String), Interceptor.createPayloadInfo(String, Object)

Method Summary
 void addToCallTree(boolean checkDuplicate, boolean useCap)
          Adds the payload info to the cumulated call tree at the current call stack.
 void calculateTime()
          Calculates the elapsed time since the creation of the payload and save it in the payload info.
 void discardTime()
          Discards the associated timing information in the payload, so that the displayed time in the JProfiler GUI will be zero.
 java.lang.String getDescription()
          Returns the description for the payload info.
 java.lang.Object getMemento()
          Retrieves the memento object.
 void setDescription(java.lang.String description)
          Sets the description for the payload info.
 void setMemento(java.lang.Object memento)
          Sets the memento object.
 

Method Detail

getDescription

java.lang.String getDescription()
Returns the description for the payload info. The checkDuplicate parameter of the addToCallTree(boolean, boolean) method works on this description.

Returns:
the description

setDescription

void setDescription(java.lang.String description)
Sets the description for the payload info.

Parameters:
description - the description

getMemento

java.lang.Object getMemento()
Retrieves the memento object.

Returns:
the memento object, can be null

setMemento

void setMemento(java.lang.Object memento)
Sets the memento object. When you are finished with the payload info (for example when you add it to the call tree), you might want to set the memento object to null, to prevent possible memory leaks.

Parameters:
memento - the memento object, can be null

addToCallTree

void addToCallTree(boolean checkDuplicate,
                   boolean useCap)
Adds the payload info to the cumulated call tree at the current call stack.

If the checkDuplicate argument is true and a duplicate payload with an equal description is detected, and calculateTime() has been called, the calculated time is added to the existing payload info.

If the useCap argument is set to true and the current call stack already contains the maximum allowed number payload infos from the same interceptor, the eldest payload info is merged into an "[Earlier calls]" payload info.

Parameters:
checkDuplicate - whether to check if a payload info with an equal description already exists at the current call stack.
useCap - whether to check the payload cap. The payload cap is defined in the JProfiler GUI and is set to 20 by default.

calculateTime

void calculateTime()
Calculates the elapsed time since the creation of the payload and save it in the payload info. This timing information is displayed in the "Call Tree" and the "Hot Spots" views in the JProfiler GUI.


discardTime

void discardTime()
Discards the associated timing information in the payload, so that the displayed time in the JProfiler GUI will be zero.


JProfiler API