O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Getting ready

The process for developing and using interceptors for an application's statistics is similar to previous techniques and include:

  1. Creating a class to maintain the application's statistics
  2. Creating interceptors to support the gathering of the statistics
  3. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required