• Post Reply Bookmark Topic Watch Topic
  • New Topic

About the important notes on p.118 of Ivan's notes

 
Himai Minh
Ranch Hand
Posts: 1400
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p.118 of Ivan's notes, the important notes :

When there are multiple interceptors of the same kind, for instance for post-construct life cycle events, a interceptor chain is built and the first interceptor method in the chain is invoked by the container.

But what I observe is all post-construct interceptors are called, not only the first interceptor method:


Output on the console:

LogInterceptor - constructor
Info: MyDefaultInterceptor.postContruct
Info: LogInterceptor.postContruct
Info: MyAroundInvokeInterceptor.postContruct
Info: *** SingletonSessionBeanA - initialized


MyAroundInvokeInterceptor is the second interceptor in the chain, but it is still invoked to intercept the @PostConstruct method in the SingletonBeanA.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2786
175
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what I observe is all post-construct interceptors are called, not only the first interceptor method

That is correct, and that is what he says in the next paragraph:
If an interceptor method takes an InvocationContext object parameter, then the proceed() method must be invoked in this object, in order for the other interceptors in the chain to be invoked.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!