Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

EJB 3.0 - Interceptors

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The core ejb 3.0 spec in section 12.3.1, reads:

"If an interceptor class itself has superclasses, the interceptor methods defined by the interceptor class�s superclasses are invoked before the interceptor method defined by the interceptor class, most general superclass first."

However, if i have this classes:

public class FatherInterceptor {
@PostConstruct
public void after1(InvocationContext contexto) {
System.out.println("Father:created...");
}
}

public class SonInterceptor extends FatherInterceptor {
@PostConstruct
public void after2(InvocationContext contexto) {
System.out.println("Son:created...");
}
}

@Interceptors(SonInterceptor.class)
public class MyBean implements MyBeanInterface{
...
}

I excepted an output like this:
Father:created...
Son:created...

but it only prints
Father:created...

So...is this the expected behaviour?

ps
i'm using Sun Aplication Server 9


Best regards..

Fabian
 
Fabian Gutierrez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, basically, the problem originated because i didn't call the proceed mthod on the InvocationContext, which also works like a chain..

public class FatherInterceptor {
@PostConstruct
public void after1(InvocationContext contexto) {
System.out.println("Father:created...");
try {
contexto.proceed();
} catch (Exception ex) {
...
}
}

}

Best reagards..
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic