File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CMT - Retry logic with setRollBackOnly()

 
Joe JosephK
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a CMT in which i do sessionCtx.setRollbackOnly() in case of a DBException (Deadlock) and throw back a BusinessException
And the client code does a retry as below:

MyBean beanProcessor = MyHome.create();
int i = 0;
for(; i < retryMaxNum; i ++){
try
{
beanProcessor.someMethod();
}
catch (BusinessException e)
{
Thread.sleep(1000);
}
}


As you see i use the same Bean instance (on which the rollback was applied) in the retry case.
Do you see any problem in this approach???

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that should work.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic