Annotation Type PayloadInterception
-
@Retention(RUNTIME) @Target(METHOD) public @interface PayloadInterceptionDeclares an interception that creates a payload. The annotated probe method must be public and static and returnStringorPayload.You can get information from the intercepted method like parameter values, the instance or the return value by declaring parameters annotated with the annotations from the com.jprofiler.api.probe.injected.parameter package. You can also declare a parameter of type
ProbeContextto open or close control objects or create payloads with enhanced functionality.If you return a
Payloadto specify control objects or custom event types you must declare a parameter of typeProbeContextand create the returned object withProbeContext.createPayload(String, Object, Enum)orProbeContext.createPayloadWithDeferredName(Object, Enum). TheinvokeOn()argument must be set toInvocationType.ENTERin that case.If you create a
Payloadwith a deferred name because the payload name cannot be determined at method entry, you must declare a method directly below the current interception method, annotate it withAdditionalInterceptionwhereAdditionalInterception.value()is set toInvocationType.EXITand return aStringfrom that method.If you don't want to create a payload for the current invocation, the probe method can return
null.
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description InvocationTypeinvokeOnThe point at which the annotated probe method is invoked.MethodSpecmethodSpecifies the method that should be intercepted.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanexceptionPayloadsIf payloads should also be recorded if the method throws an exception.booleanreentrantIndicates if your interception is reentrant.
-
-
-
Element Detail
-
invokeOn
InvocationType invokeOn
The point at which the annotated probe method is invoked.- Returns:
- the invocation type
-
-
-
method
MethodSpec method
Specifies the method that should be intercepted.- Returns:
- a method specification
-
-
-
reentrant
boolean reentrant
Indicates if your interception is reentrant. Iffalse, the probe method will not be called for recursive invocations of the intercepted method.If
true, the payload name (and the other information inPayload) returned by the subsequent inner calls will be used, but timing and call tree location will be used from the outermost call. You can useProbeContext.restartTiming()andProbeContext.restartTimingAndLocation()to customize this behavior. If you want to retain the name from outer calls you can useProbeContext.getOuterPayload().- Returns:
- if your probe method should be called for recursive invocations
- Default:
- false
-
-
-
exceptionPayloads
boolean exceptionPayloads
If payloads should also be recorded if the method throws an exception. IfinvokeOn()is set toInvocationType.EXCEPTIONorInvocationType.EXIT, JProfiler will always record payloads for exceptional exits.- Returns:
- if payloads should be recorded for exceptional exits
- Default:
- false
-
-