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 TypeMethodDescriptionvoidcloseControlObject(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.booleanReturns the recording state of the probe.voidopenControlObject(Object controlObject, String name) Records an open event for a control object and assigns a name to it.voidIf a payload is currently recorded by an outer interception, restart timing.voidIf a payload is currently recorded by an outer interception, restart timing and set the call tree to the location of the latestPayloadInterceptionor the latestSplitInterceptionwithSplitInterception.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()totrueto 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
Payloadthat is either annotated withPayloadInterceptionand wherePayloadInterception.invokeOn()is set toInvocationType.ENTER -
a method with
SplitInterceptionandSplitInterception.payloads()set totrue
If you don't want to assign states or control objects, you can just return the name as a
Stringdirectly.- 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
Payloadinstance 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 aPayloadthat is annotated withPayloadInterceptionand wherePayloadInterception.invokeOn()is set toInvocationType.ENTER. If you don't want to assign states or control objects you can just return the name as aStringdirectly.To supply the name at a later point, you have to define a method right below the current method, annotate it with
AdditionalInterceptionand return aString.If you don't want to assign states or control objects, you can set
PayloadInterception.invokeOn()toInvocationType.EXITand return the name as aStringdirectly.- 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
Payloadinstance 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. ASplitInterceptionwon't change an outer payload, so this does not apply for nested splits.- Returns:
- the current payload or
nullif 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 latestPayloadInterceptionor the latestSplitInterceptionwithSplitInterception.payloads()set totrue. -
isRecording
boolean isRecording()Returns the recording state of the probe.Methods annotated with
PayloadInterceptionare only called when probe recording is turned on. Methods annotated withSplitInterceptionare 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 withInterceptionare always called.- Returns:
trueif your probe is being recorded
-