Using interceptors to handle application statistics
The gathering of application statistics is a common requirement. It may be desirable to determine how many times a method is executed or how much time is spent in a method. This recipe illustrates collecting both of these types of statistics using a chain of interceptors.
The process for developing and using interceptors for an application's statistics is similar to previous techniques and include:
- Creating a class to maintain the application's statistics
- Creating interceptors to support the gathering of the statistics
- Using the @Interceptors annotation to designate a target method
In this recipe we will create two interceptors. The first will keep track of the number of times a method ...