Probe class for monitoring method invocation events is a Java class which meets the following requirements:
It must be annotated with @MethodPattern annotation in order to specify which methods the probe will be applied to.
It must define at least one of the following callback methods (must be public static too):
returnor when a void method body execution completes)
Bytecode instrumentation engine will inject calls to your probes to the methods which you specified on probe registration.
You can access method parameters, method return value, the object for which the method is called, as well as intercept uncaught exceptions thrown in the method. This provides virtually unlimited capabilities to monitor applications.
Write the probe classes.
How to write the probe class and how many probe classes you need, depends on your task.
You may intend one probe class to handle one method call only, or you can write a probe with a pattern which corresponds to several methods which you want to handle uniformly. Also, you may need several probes to solve one complex task.
Take a look at the built-in probes to get some ideas on how to write your own ones.
Register the probe classes to make them work.