public interface InterceptorContext extends ProbeContext
interceptor probes
.
It extends the capabilities of the parent interface
to provide support for
payload creation and management.
The help topic on custom probes in the bundled documentation explains how to develop custom probes.
Modifier and Type | Method and Description |
---|---|
void |
addPayloadInfo(PayloadInfo payloadInfo)
Publishes the payload into the call tree.
|
ProbeEvent |
createCloseEvent(PayloadInfo payloadInfo,
java.lang.Object controlObject)
Creates an event for closing a control object with payload information.
|
ProbeEvent |
createCustomEvent(PayloadInfo payloadInfo,
int type,
java.lang.Object controlObject)
Creates a custom event with payload information.
|
ProbeEvent |
createOpenEvent(PayloadInfo payloadInfo,
java.lang.Object controlObject)
Creates an event for opening a control object with payload information.
|
PayloadInfo |
createPayloadInfo(java.lang.String description)
Creates a payload info object for this interceptor probe.
|
PayloadInfo |
createPayloadInfo(java.lang.String description,
java.lang.Object memento)
Creates a payload info object for this interceptor probe with a memento object.
|
java.lang.String |
getOpenEventDescription(java.lang.Object controlObject)
Returns the description that was used for creating a control object.
|
boolean |
implementsInterface(java.lang.Class clazz,
java.lang.String interfaceName)
Helper method to check whether the provided class implements an interface.
|
boolean |
isPayloadStackEmpty()
Check if the payload stack is empty.
|
boolean |
isTargetMethod(java.lang.String actualMethodName,
java.lang.String actualMethodSignature,
java.lang.String targetMethodName,
java.lang.String targetMethodSignature)
Helper method to check if a method name and signature are equivalent with target values.
|
PayloadInfo |
pop()
Retrieves a payload that was saved to the thread local stack with
push(PayloadInfo) . |
void |
push(PayloadInfo payloadInfo)
Saves a payload to a thread local stack.
|
void |
startCustomState(java.lang.Object controlObject,
int type)
Change the state of a control object for the time line view.
|
addEvent, createCloseEvent, createCustomEvent, createOpenEvent, createOpenEvent, getMap, isRecording
PayloadInfo createPayloadInfo(java.lang.String description)
PayloadInfo
for more information.description
- the payload descriptionPayloadInfo createPayloadInfo(java.lang.String description, java.lang.Object memento)
PayloadInfo
for more information.description
- the payload descriptionmemento
- a memento object for information that you need in order to analyze the payload info in a different context.boolean implementsInterface(java.lang.Class clazz, java.lang.String interfaceName)
clazz
- the object whose class should be checkedinterfaceName
- the name of the interface that should be checkedboolean isTargetMethod(java.lang.String actualMethodName, java.lang.String actualMethodSignature, java.lang.String targetMethodName, java.lang.String targetMethodSignature)
actualMethodName
- the method name as passed to the interceptor methodsactualMethodSignature
- the method signature as passed to the interceptor methodstargetMethodName
- the method name against which you are testingtargetMethodSignature
- the method signature against which you are testing in JVM format. See InterceptionMethod
for more information on that format.void addPayloadInfo(PayloadInfo payloadInfo)
ProbeMetaData.payload(boolean)
has to be called with the argument true
in the meta data configuration method
.payloadInfo
- the payload that should be published.void push(PayloadInfo payloadInfo)
pop()
later on. The typical use case is to create a payload during the method entry, creating its
payload name from the arguments of the intercepted method or other data. During method exit, you then calculate
times and publish it.payloadInfo
- the payload infoPayloadInfo pop()
push(PayloadInfo)
.null
.boolean isPayloadStackEmpty()
push(PayloadInfo)
.ProbeEvent createOpenEvent(PayloadInfo payloadInfo, java.lang.Object controlObject)
ProbeContext.createOpenEvent(String, Object)
with payload. The description of the event is taken from the
payload name.
Note that the returned event must be published with ProbeContext.addEvent(ProbeEvent)
, otherwise
the event will be discarded.
payloadInfo
- the payload infocontrolObject
- the control object that is being openedProbeEvent createCloseEvent(PayloadInfo payloadInfo, java.lang.Object controlObject)
ProbeContext.createCloseEvent(String, Object)
with payload. The description of the event is taken from the
payload name.
Note that the returned event must be published with ProbeContext.addEvent(ProbeEvent)
, otherwise
the event will be discarded.
payloadInfo
- the payload infocontrolObject
- the control object that is being closedProbeEvent createCustomEvent(PayloadInfo payloadInfo, int type, java.lang.Object controlObject)
ProbeContext.createCustomEvent(String, int, Object)
. The description of the event is taken from the
payload name.
Note that the returned event must be published with ProbeContext.addEvent(ProbeEvent)
, otherwise
the event will be discarded.
payloadInfo
- the payload infotype
- the type corresponds to the index of the desired custom event in the the call to
ProbeMetaData.customTypeNames(String[])
controlObject
- the control object for this event. Can be null
.void startCustomState(java.lang.Object controlObject, int type)
ProbeMetaData.customColors(int[])
. The indices correspond to the custom states defined with
ProbeMetaData.customTypeNames(String[])
. Usually, this is done automatically based on the published
custom events. If you do not want to publish, associated events, you can used this method to change the state of
a control object.controlObject
- the control object whose state should be changedtype
- the new state. This is the index of the desired custom state in the call to
ProbeMetaData.customTypeNames(String[])
.java.lang.String getOpenEventDescription(java.lang.Object controlObject)
description
parameter in createOpenEvent(PayloadInfo, Object)
.controlObject
- the control object