public interface ProbeContext
Interception
, PayloadInterception
, SplitInterception
and AdditionalInterception
,
you can declare a parameter of this type in any position in order to get an instance of this class.Modifier and Type | Method and Description |
---|---|
void |
closeControlObject(java.lang.Object controlObject)
Closes a control object.
|
Payload |
createPayload(java.lang.String name,
java.lang.Object controlObject,
java.lang.Enum<?> type)
Creates an enhanced payload object with type and control object info.
|
Payload |
createPayloadWithDeferredName(java.lang.Object controlObject,
java.lang.Enum<?> type)
Creates an enhanced payload object with type and control object info which name you don't know yet.
|
Payload |
getOuterPayload()
Retrieves the payload information that has been created by an outer interception, either through recursion or by a different intercepted method.
|
boolean |
isRecording()
Returns the recording state of the probe.
|
void |
openControlObject(java.lang.Object controlObject,
java.lang.String name)
Records an open event for a control object and assigns a name to it.
|
void |
restartTiming()
If a payload is currently recorded by an outer interception, restart timing.
|
void |
restartTimingAndLocation()
If a payload is currently recorded by an outer interception, restart timing and set the call tree to the location of the latest
PayloadInterception or the latest SplitInterception with SplitInterception.payloads() set to true . |
void openControlObject(java.lang.Object controlObject, java.lang.String name)
Probe.controlObjects()
to true
to enable control object recording as a capability for the probe.
If you don't use this method and a previously unknown control object is used in a createPayload(String, Object, Enum)
call and
you have annotated a method in your probe class with ControlObjectName
, that method will be called create a name for the new control object.
No open event will be created in the events view in that case.
controlObject
- the control objectname
- the name of the control objectvoid closeControlObject(java.lang.Object controlObject)
controlObject
- the control objectPayload createPayload(java.lang.String name, java.lang.Object controlObject, java.lang.Enum<?> type)
Creates an enhanced payload object with type and control object info. You can use the created object in
Payload
that is either annotated with PayloadInterception
and
where PayloadInterception.invokeOn()
is set to InvocationType.ENTER
SplitInterception
and SplitInterception.payloads()
set to true
If you don't want to assign states or control objects, you can just return the name as a String
directly.
name
- the name of the recorded payload. If null
, the payload recording will be discarded.type
- the payload type. Must by an object of your custom enum class registered with Probe.customTypes()
or null
.controlObject
- the control object this payload belongs to or null
. If control objects should be recorded, you have to set Probe.controlObjects()
to true
.Payload
instance to be returned by your interception methodPayload createPayloadWithDeferredName(java.lang.Object controlObject, java.lang.Enum<?> type)
Payload
that is annotated with PayloadInterception
and
where PayloadInterception.invokeOn()
is set to InvocationType.ENTER
. If you don't want to assign
states or control objects you can just return the name as a String
directly.
To supply the name at a later point, you have to define a method right below the current method, annotate it with AdditionalInterception
and return a String
.
If you don't want to assign states or control objects, you can set PayloadInterception.invokeOn()
to InvocationType.EXIT
and return the name as a String
directly.
type
- the payload type. Must by an object of your custom enum class registered with Probe.customTypes()
or null
.controlObject
- the control object this payload belongs to or null
. If control objects should be recorded, you have to set Probe.controlObjects()
to true
.Payload
instance to be returned by your interception methodPayload getOuterPayload()
If your inner interception method is annotated with PayloadInterception
, you can return this payload to keep the payload information unchanged. A SplitInterception
won't
change an outer payload, so this does not apply for nested splits.
null
if there is no current payload defined.void restartTiming()
void restartTimingAndLocation()
PayloadInterception
or the latest SplitInterception
with SplitInterception.payloads()
set to true
.boolean isRecording()
Methods annotated with PayloadInterception
are only called when probe recording is turned on. Methods annotated with SplitInterception
are called when CPU or allocation recording is turned on. If SplitInterception.payloads()
is set to true
, they are also called when only probe recording is turned on.
Methods annotated with Interception
are always called.
true
if your probe is being recorded