| Author |
CMT - Retry logic with setRollBackOnly()
|
Joe JosephK
Greenhorn
Joined: Dec 14, 2009
Posts: 1
|
|
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
Joined: Apr 14, 2004
Posts: 10336
|
|
|
No, that should work.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
 |
|
|
subject: CMT - Retry logic with setRollBackOnly()
|
|
|