Welcome to Dream.In.Code
Become a Java Expert!

Join 150,201 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,021 people online right now. Registration is fast and FREE... Join Now!




Java Transaction Handling

 
Reply to this topicStart new topic

Java Transaction Handling, Am I missing something?

NickDMax
25 Sep, 2008 - 07:45 AM
Post #1

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,869



Thanked: 53 times
Dream Kudos: 550
My Contributions
So I have been given the mandate to ensure that certain actions are preformed whenever a transaction rolls back.

Problem: I don't seem to have a way to TELL when there has been a rollback.

So I have a middleware solution that deals with several transactional components. My application is left with the unpleasant task of ensuring that when there is an error, some transactions roll back, while some other transactions occur (like a message to a JMS error queue).

So I tried using a UserTransaction to give me insight into the overall transaction, BUT the UserTransaction is more or less useless since I can setRollbackOnly, or I can actually preform a rollback BUT what I can't do is tell if setRollBackOnly has been set (Which you can for DB connections or even JMS Sessions -- just not UserTransactions), or if any of the other transactions have rolled back.

SO to get arround this I have had to make another object called "RollBackState" (an AtomicBoolean) and try like hell to ensure that every conceivable error condition that may cause a rollback also sets this variable so that in the unlikely event of a rollback I can preform all the other actions that need to occur.

How does one implement a more robust transaction? Do I need to write my own Transaction Manager and register it with the Application Server like a JMS or DB resource?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 05:03AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month