• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Interceptors invocation sequence?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,
I was trying out some features of the EJB Interceptors and came to a strange behavior:

Statefull session bean defines class interceptor.
Upon calling a method, first is fired the class interceptor, and then the method itself (this is normal).
Console output:



Once I added @PostConstruct to the session bean and to the ClassInterceptor I got the following (normal) behavior:


Now for the weird part: I add a @PostConstruct method in the MethodInterceptor, which is assigned to a *totally* different method from the one being called in the session bean, and I get the following (non-normal?) behavior:


No interceptors are defined in ejb-jar.xml

My Bean code:


ClassInterceptor (MethodInterceptor is identical, just a different .java)



The client:


My question is: why is @PostConstruct on the MethodInterceptor called? It's associated with a method that is not even called at all (demostrated by it's @AroundInvoke method non being called).

Any ideas?

Regards

Alejandro

Edited: forgot to add: using JBoss 4.0.5
[ June 06, 2007: Message edited by: Alejandro Dominguez ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It kind of reminds me of the joke.

Man goes into the doctor's office and raises his hand and arm above his head and says "Doctor it hurts when I do this". Doctor says, "Then don't do that"



Mark
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic