Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exceptions in lifecycle callback methods (I)

 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

the ejb core spec says (12.4.2, page 307):
A lifecycle callback interceptor method may catch an exception thrown by another lifecycle callback interceptor method in the invocation chain
Has anybody an example on how this works ?

For example, given the following interceptor class How would a lifecycle callback method in a following interceptor class catch myException ?
[ October 21, 2008: Message edited by: Ralph Jaus ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an interceptor callback, you usually call proceed() to propagate the call down the chain. This is where you can catch an exception.

 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Christophe, now it's clear.

So if there are lifecycle callback interceptors
then the interceptor chain works (in principal) like
Now the usual java exception handling can be applied.
[ October 22, 2008: Message edited by: Ralph Jaus ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic