Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between userTransaction.rollback() & userTransaction timeout

 
Sajid Moinuddin
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic