aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes difference between userTransaction.rollback() & userTransaction timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "difference between userTransaction.rollback() & userTransaction timeout " Watch "difference between userTransaction.rollback() & userTransaction timeout " New topic
Author

difference between userTransaction.rollback() & userTransaction timeout

Sajid Moinuddin
Ranch Hand

Joined: Mar 19, 2005
Posts: 85
Hi all,
I am using stateful session bean and BMT to manage my transaction. I am keeping an open transaction in one of my method. I am expecting the user to call a second method to commit/rollback the transaction. Now, If the user doesn't call the second method, I am setting the transaction timeout. I want the transaction to be discarded if the user doesn't call the second method by 5 seconds. I am expecting the same behavior as the rollback(). Now, though my transaction times out, it doesn't release the locks on db / other resources like it does in case of roll back. Now, What is the difference between timeout and rollback? How can I discard my transaction if user doesn't call the second method??(should i use timer service!!)

regards,
Sajid
Sajid Moinuddin
Ranch Hand

Joined: Mar 19, 2005
Posts: 85
I am really sorry for multiple posts...there were some problem with my connection and i was getting the failure notice while my posts were going ok...
sorry again.
sajid
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
The general behaviour of transaction timeout is, it should rollback the transaction. You should make sure that you have set timeout for transaction before you begin it.. This is what the behaviour of J2EE SDK, Weblogic.. But I am not sure how other containers implement this.. It makes me sense that all containers should do the same behaviour. Also I am not sure whether this has been defined in EJB spec or not. We can verify by glancing spec once..


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
 
 
subject: difference between userTransaction.rollback() & userTransaction timeout