• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Valentin Crettaz's cheat sheets Exception Handling

 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

On the first page in the ExceptionHandling.pdf document, it is mentioned under the heading "Client View":

if(ctx.getRollbackOnly())
//impossible to commit tx
else
//do more work and commit tx

What is this ctx? Is it SessionContext/EntityContext? If the answer is yes then how the standalone/remote client (non-EJB) gets access to SessionContext/EntityContext? This can only be true this were a EJB making call on other EJB? Please clarify my doubt.

Thanks

-- Ravi
 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A bean calling another bean may be called a client.

Any bean's way of knowing if 'setRollbakOnly()' has been called by some bean and/or method earlier is to query its own context by calling 'getRollbackOnly()'

So if Bean A calls Bean B,
1. Bean A is said to be a client of Bean B
2. Bean B might query its own context to check if any bean in the call stack has already called 'setRollbackOnly()'. If yes, Bean B might not go ahead with all the processing and waste time.

Regards,
Leena
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Leena

Thanks for the detailed explanation.

Regards

-- Ravi
 
reply
    Bookmark Topic Watch Topic
  • New Topic