• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

client view of exceptions

 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which one of the following statements regarding the client view of exceptions received from an enterprise bean invocation is correct?

1. The client can safely continue the transaction by retrying the operation if an application exception is received.

2. The client can safely continue the transaction by retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.

3. The client can safely continue the transaction by retrying the operation if a non-application exception is received.

4. A local client cannot continue a transaction if javax.transaction.TransactionRolledbackLocalException is received.

5. A remote client cannot continue a transaction if javax.transaction.TransactionRolledbackException is received.
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Parmeet Sarpal ,
Would this help?

5) is correct..javax.transaction.TransactionRolledbackException is system exception and would apply sementics of System Exception.
if you'r thinking about (4) , packate should be javax.ejb.....
Amol.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the answer 2 & 5 are correct.

Right, Amol?

Gemini

[ March 21, 2005: Message edited by: Gemini Moses ]
[ March 21, 2005: Message edited by: Gemini Moses ]
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to www.ejbcertificate.com the correct answer is 5. Why not 2?
 
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

(2) is wrong since the DB is in indeterministic state because of the data changes done using the prior business method call which should have either been rolled back or committed before the client makes a safe business method call again.

Thanks

Ravi
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ravindra, it sounds good
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of
The client can safely continue the transaction by retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.

If the statement would have been
The client can safely continue the transaction by handling the exception and retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.

Would it have been correct answer?

Thanks,
Gemini
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think option 2 is rather unclear. It depends on how you might interprete "continue" to be. Is it without any attempts to handle the exception? Or it meant handling the exception & retry to commit.
 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
Gemini,
Again, this is ejb certificate question and as most its unclear about its meaning.But if its only 1 answer you have to choose ,go for 5.
Amol.
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Specifications says

The EJB specification for exception handling is designed to meet these high-level goals:
� An application exception thrown by an enterprise bean instance should be reported to the client precisely (i.e., the client gets the same exception).
� An application exception thrown by an enterprise bean instance should not automatically rollback a client�s transaction. The client should typically be given a chance to recover a transaction from an application exception.
� An unexpected exception that may have left the instance�s state variables and/or underlying persistent data in an inconsistent state can be handled safely.

Thanks

-- Ravi
[ March 27, 2005: Message edited by: ravindra janapareddy ]
 
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

I want to revise my previously statement that (2) is "wrong" to (2) is "right" and this is because while reading EJB specs, I have come across this:

If a client program receives an app exception from an EJB invocation while the client is associated with a tx, the client can typically continue the tx because an app exception does not automatically cause the container to mark the tx for rollback.

Although the container does not automatically mark for rollback a tx because of a thrown app exception, the tx might have been marked for rollback by the EJB instance before it threw the app exception.

There are two ways to learn if a particular app exception results in tx rollback or not:
� Statically. Programmers can check the docs of the EJB�s home or component interface. The Bean Provider may have specified the app exceptions for which the EJB marks the tx for rollback before throwing the exception.
� Dynamically. Clients that are EJB with container-managed transaction demarcation can use the getRollbackOnly method of the javax.ejb.EJBContext object to learn if the current tx has been marked for rollback; other clients may use the get-Status method of the javax.transaction.UserTransaction interface to obtain the tx status.

Thanks

-- Ravi
[ March 28, 2005: Message edited by: Ravindra Janapareddy ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic