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.-
Method Summary
Modifier and TypeMethodDescriptionvoid
closeControlObject
(Object controlObject) Closes a control object.createPayload
(String name, Object controlObject, Enum<?> type) Creates an enhanced payload object with type and control object info.createPayloadWithDeferredName
(Object controlObject, Enum<?> type) Creates an enhanced payload object with type and control object info which name you don't know yet.Retrieves the payload information that has been created by an outer interception, either through recursion or by a different intercepted method.boolean
Returns the recording state of the probe.void
openControlObject
(Object controlObject, String name) Records an open event for a control object and assigns a name to it.void
If a payload is currently recorded by an outer interception, restart timing.void
If a payload is currently recorded by an outer interception, restart timing and set the call tree to the location of the latestPayloadInterception
or the latestSplitInterception
withSplitInterception.payloads()
set totrue
.
-
Method Details
-
openControlObject
Records an open event for a control object and assigns a name to it. The control object will be displayed in the control objects view and the timeline. You must setProbe.controlObjects()
totrue
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 withControlObjectName
, 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.- Parameters:
controlObject
- the control objectname
- the name of the control object
-
closeControlObject
Closes a control object. If the control object is not currently open, this method has no effect.- Parameters:
controlObject
- the control object
-
createPayload
Creates an enhanced payload object with type and control object info. You can use the created object in
- a method returning a
Payload
that is either annotated withPayloadInterception
and wherePayloadInterception.invokeOn()
is set toInvocationType.ENTER
-
a method with
SplitInterception
andSplitInterception.payloads()
set totrue
If you don't want to assign states or control objects, you can just return the name as a
String
directly.- Parameters:
name
- the name of the recorded payload. Ifnull
, the payload recording will be discarded.type
- the payload type. Must by an object of your custom enum class registered withProbe.customTypes()
ornull
.controlObject
- the control object this payload belongs to ornull
. If control objects should be recorded, you have to setProbe.controlObjects()
totrue
.- Returns:
- a
Payload
instance to be returned by your interception method
- a method returning a
-
createPayloadWithDeferredName
Creates an enhanced payload object with type and control object info which name you don't know yet. You can use the created object in a method returning aPayload
that is annotated withPayloadInterception
and wherePayloadInterception.invokeOn()
is set toInvocationType.ENTER
. If you don't want to assign states or control objects you can just return the name as aString
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 aString
.If you don't want to assign states or control objects, you can set
PayloadInterception.invokeOn()
toInvocationType.EXIT
and return the name as aString
directly.- Parameters:
type
- the payload type. Must by an object of your custom enum class registered withProbe.customTypes()
ornull
.controlObject
- the control object this payload belongs to ornull
. If control objects should be recorded, you have to setProbe.controlObjects()
totrue
.- Returns:
- a
Payload
instance to be returned by your interception method
-
getOuterPayload
Payload getOuterPayload()Retrieves the payload information that has been created by an outer interception, either through recursion or by a different intercepted method.If your inner interception method is annotated with
PayloadInterception
, you can return this payload to keep the payload information unchanged. ASplitInterception
won't change an outer payload, so this does not apply for nested splits.- Returns:
- the current payload or
null
if there is no current payload defined.
-
restartTiming
void restartTiming()If a payload is currently recorded by an outer interception, restart timing. -
restartTimingAndLocation
void restartTimingAndLocation()If a payload is currently recorded by an outer interception, restart timing and set the call tree to the location of the latestPayloadInterception
or the latestSplitInterception
withSplitInterception.payloads()
set totrue
. -
isRecording
boolean isRecording()Returns the recording state of the probe.Methods annotated with
PayloadInterception
are only called when probe recording is turned on. Methods annotated withSplitInterception
are called when CPU or allocation recording is turned on. IfSplitInterception.payloads()
is set totrue
, they are also called when only probe recording is turned on. Methods annotated withInterception
are always called.- Returns:
true
if your probe is being recorded
-