public interface InterceptorProbe extends Probe
Note that implementation classes that are observed by an interceptor are only available if they are in the boot classpath. Since this is usually not the case, you have to check class hierarchies by using the reflection API.
Important:Interceptors cannot intercept methods in the following classes:
Probes are added to the profiled process with a ProbeProvider
.
ProbeProvider
Modifier and Type | Method and Description |
---|---|
InterceptionMethod[] |
getInterceptionMethods()
Defines the methods that should be intercepted by this interceptor probe.
|
void |
interceptionEnter(InterceptorContext context,
java.lang.Object object,
java.lang.Class declaringClass,
java.lang.String declaringClassName,
java.lang.String methodName,
java.lang.String methodSignature,
java.lang.Object[] arguments)
Called when an intercepted method is entered.
|
void |
interceptionExceptionExit(InterceptorContext context,
java.lang.Object object,
java.lang.Class declaringClass,
java.lang.String declaringClassName,
java.lang.String methodName,
java.lang.String methodSignature,
java.lang.Throwable throwable)
Called when an in intercepted method is exited because an exception is thrown.
|
void |
interceptionExit(InterceptorContext context,
java.lang.Object object,
java.lang.Class declaringClass,
java.lang.String declaringClassName,
java.lang.String methodName,
java.lang.String methodSignature,
java.lang.Object returnValue)
Called when an intercepted method is exited via a regular return call.
|
getMetaData
void interceptionEnter(InterceptorContext context, java.lang.Object object, java.lang.Class declaringClass, java.lang.String declaringClassName, java.lang.String methodName, java.lang.String methodSignature, java.lang.Object[] arguments) throws java.lang.Throwable
InterceptorContext.push(PayloadInfo)
. You can retrieve it again with
InterceptorContext.pop()
in the
interceptionExceptionExit(InterceptorContext, Object, Class, String, String, String, Throwable)
method
in order to calculate times and to publish it.
If you perform wildcard interception based on method names only, you should check if the object has the expected class hierarchy.
context
- the context you can use to create payload and probe dataobject
- the object on which the intercepted method was calleddeclaringClass
- the class object where the intercepted method has been declared. This is null on JVMs prior to version 1.6.declaringClassName
- the class where the intercepted method has been declaredmethodName
- the name of the intercepted methodmethodSignature
- the signature of the intercepted method in JVM format. See InterceptionMethod
for more information on that format.arguments
- the arguments that were passed to the intercepted method or an empty array if the method has no arguments. @see #createPayloadInfo(String) @see #createPayloadInfo(String, Object)java.lang.Throwable
void interceptionExit(InterceptorContext context, java.lang.Object object, java.lang.Class declaringClass, java.lang.String declaringClassName, java.lang.String methodName, java.lang.String methodSignature, java.lang.Object returnValue) throws java.lang.Throwable
PayloadInfo.calculateTime()
on the payload info
that you created in interceptionEnter(InterceptorContext, Object, Class, String, String, String, Object[])
.context
- the context you can use to create payload and probe dataobject
- the object on which the intercepted method was calleddeclaringClass
- the class object where the intercepted method has been declared. This is null on JVMs prior to version 1.6.declaringClassName
- the class where the intercepted method has been declaredmethodName
- the name of the intercepted methodmethodSignature
- the signature of the intercepted method in JVM format. See InterceptionMethod
for more information on that format.returnValue
- the value that was returned by the intercepted method or null if the return type of the method is void.java.lang.Throwable
void interceptionExceptionExit(InterceptorContext context, java.lang.Object object, java.lang.Class declaringClass, java.lang.String declaringClassName, java.lang.String methodName, java.lang.String methodSignature, java.lang.Throwable throwable) throws java.lang.Throwable
context
- the context you can use to create payload and probe dataobject
- the object on which the intercepted method was calleddeclaringClass
- the class object where the intercepted method has been declared. This is null on JVMs prior to version 1.6.declaringClassName
- the class where the intercepted method has been declaredmethodName
- the name of the intercepted methodmethodSignature
- the signature of the intercepted method in JVM format. See InterceptionMethod
for more information on that format.throwable
- the exception that was thrown in the intercepted methodjava.lang.Throwable
InterceptionMethod[] getInterceptionMethods()
InterceptionMethod
for more information.