This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about exception

 
Li Xin
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a question about EJB exception:
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.
The provided answer is 5 only, but I think 2 and 4 are also correct, any idea about this?
Thanks.
 
Sunil Patil
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you.
Sunil
 
Janne Karhu
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- Question 2 is confusing; what does the "safely" really mean in this case? I would bet that 2 is correct anyway (if the client is EJB, use getRollbackOnly() and if not, use UserTransaction.getStatus()).
- Question 4 is correct in my opinion. How is it supposed to differ from question 5?

Originally posted by Li Xin:
Here is a question about EJB exception:
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.
The provided answer is 5 only, but I think 2 and 4 are also correct, any idea about this?
Thanks.
 
Jack Zhou
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
4 in incorrect because local client receivs javax.ejb.TransactinRolledBackExcepiton not the one in javax.transaction pacage.
1) is wrong becuase you don't know if the transaction is rolled back
2) is wrong becuase if don't have a way to know if it is rolled back if it is containers started the transaction and the bean make decision in this code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic