-
Java Pseudo Transactions With Non-Transactional Resources (15 messages)
- Posted by: Nuno Teixeira
- Posted on: January 26 2009 13:25 EST
When working in enterprise environments, it is often necessary to interact with multiple resources in a single atomic unit of work - a distributed transaction. The ideal way to accomplish this is by leveraging JTA to manage the distributed transaction. However, in transaction scenarios where one or more resources do not support XA transactions JTA cannot be used. Justin McCarter and Travis Alvey describe a method of interacting with non-transactional resources in a pseudo-transaction. Read articleThreaded Messages (15)
- Re: Java Pseudo Transactions With Non-Transactional Resources by han theman on January 26 2009 16:19 EST
- Re: Java Pseudo Transactions With Non-Transactional Resources by han theman on January 26 2009 16:19 EST
- Re: Java Pseudo Transactions With Non-Transactional Resources by Dushyanth Inguva on January 26 2009 11:49 EST
- for the article by icq full on May 26 2009 07:50 EDT
- Re: Java Pseudo Transactions With Non-Transactional Resources by han theman on January 26 2009 16:19 EST
- Re: Java Pseudo Transactions With Non-Transactional Resources by Christopher Brind on January 26 2009 18:21 EST
- Is there any Example on how to implement XAResources? by Alessandro Carraro on January 27 2009 04:05 EST
- Re: Is there any Example on how to implement XAResources? by Martijn Verburg on January 27 2009 09:45 EST
- Re: Is there any Example on how to implement XAResources? by Guido Anzuoni on January 30 2009 04:02 EST
- XA patterns by Kit Davies on January 27 2009 05:52 EST
- Re: Java Pseudo Transactions With Non-Transactional Resources by Satadru Roy on January 28 2009 16:45 EST
- Re: Java Pseudo Transactions With Non-Transactional Resources by Tom Barnes on January 29 2009 17:47 EST
-
Re: Java Pseudo Transactions With Non-Transactional Resources by Satadru Roy on February 02 2009 03:16 EST
-
Re: Java Pseudo Transactions With Non-Transactional Resources by Tom Barnes on February 03 2009 10:10 EST
-
Re: Java Pseudo Transactions With Non-Transactional Resources by Tom Barnes on February 03 2009 10:21 EST
- links by matt coleman on December 03 2012 11:54 EST
-
Re: Java Pseudo Transactions With Non-Transactional Resources by Tom Barnes on February 03 2009 10:21 EST
-
Re: Java Pseudo Transactions With Non-Transactional Resources by Tom Barnes on February 03 2009 10:10 EST
-
Re: Java Pseudo Transactions With Non-Transactional Resources by Satadru Roy on February 02 2009 03:16 EST
- Re: Java Pseudo Transactions With Non-Transactional Resources by Tom Barnes on January 29 2009 17:47 EST
-
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: han theman
- Posted on: January 26 2009 16:19 EST
- in response to Nuno Teixeira
Clicking "Read article" doesn't quite work in FF. -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: han theman
- Posted on: January 26 2009 16:19 EST
- in response to han theman
Once i posted the comment, it worked. Bug? -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: Dushyanth Inguva
- Posted on: January 26 2009 23:49 EST
- in response to han theman
Once i posted the comment, it worked. Bug?
Nope. It is called being trigger happy. Just Kidding :-) -
for the article[ Go to top ]
- Posted by: icq full
- Posted on: May 26 2009 07:50 EDT
- in response to han theman
thnx for the post.. best regards; porno izle -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: Christopher Brind
- Posted on: January 26 2009 18:21 EST
- in response to Nuno Teixeira
Apart from using Throwable all over the place (what happens if you get an OutOfMemoryError for instance, is it valid to try and handle this because surely the VM is FUBAR at this point and tracing the problem will be a nightmare?) it's a good example of the kind of thing the Command pattern is suited for. -
Is there any Example on how to implement XAResources?[ Go to top ]
- Posted by: Alessandro Carraro
- Posted on: January 27 2009 04:05 EST
- in response to Nuno Teixeira
My company has developed an (unfortunately, because IMHO it's really good!) closed source Persistance framework. It is actually transactional, because you can rollback the changes made to the data, by snapshooting the data on change event, and restore the old data programmatically or automatically (on error while persisting, or if the business logic say that the object has invalid data) I once wished to make it XA-compliance (it was not a real feature request, but I thougt it would be cool...) and started to read the sepcification and some tutorials. Here is my question to the community: I could not find examples or tutorials about IMPLEMENTING XA transactions (on pojos, for example). I could only find tutorials on using transactions. Our implementation is actually similar the one explained in the article, ie. we have a rollback method on "our" session object. Is there a way to transform that pseudo transaction in a REAL one? A guide (book or online) on implementing XAResource? -
Re: Is there any Example on how to implement XAResources?[ Go to top ]
- Posted by: Martijn Verburg
- Posted on: January 27 2009 09:45 EST
- in response to Alessandro Carraro
There isn't much good documentation that we've found (I write JCA connectors that are XA or partially XA, such as an FTP Connector). Your best bet is any documentation you can find about JCA, they often have snippets of info. Application vendor documentation aimed at developers often have a Gem or two hidden away. But indeed this is a pretty dark art :) -
Re: Is there any Example on how to implement XAResources?[ Go to top ]
- Posted by: Guido Anzuoni
- Posted on: January 30 2009 04:02 EST
- in response to Alessandro Carraro
My company has developed an (unfortunately, because IMHO it's really good!) closed source Persistance framework. It is actually transactional, because you can rollback the changes made to the data, by snapshooting the data on change event, and restore the old data programmatically or automatically (on error while persisting, or if the business logic say that the object has invalid data)
This might help: http://jroller.com/pyrasun/category/XA You can also take a look at the example in OpenOrb TransactionService: http://sourceforge.net/project/showfiles.php?group_id=43608 Mainly, there is an object holding the committed state (some sort of backend) with a number of resource that hold transactional state (the XA resources enlisted in different transactions). Hope it helps. Guido
I once wished to make it XA-compliance (it was not a real feature request, but I thougt it would be cool...) and started to read the sepcification and some tutorials.
Here is my question to the community: I could not find examples or tutorials about IMPLEMENTING XA transactions (on pojos, for example). I could only find tutorials on using transactions.
Our implementation is actually similar the one explained in the article, ie. we have a rollback method on "our" session object.
Is there a way to transform that pseudo transaction in a REAL one? A guide (book or online) on implementing XAResource? -
XA patterns[ Go to top ]
- Posted by: Kit Davies
- Posted on: January 27 2009 05:52 EST
- in response to Nuno Teixeira
I probably shouldn't be doing this ;) but there's another good article on XA patterns here http://www.javaworld.com/javaworld/jw-01-2009/jw-01-spring-transactions.html Spring-focussed but ideas are transferrable. -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: Satadru Roy
- Posted on: January 28 2009 16:45 EST
- in response to Nuno Teixeira
Actually it's not entirely true that you cannot use JTA unless all participants are XA-aware. Quite a few JTA implementations offer optimizations where one participant, at most, can be a non XA RM participating in a 2pc transaction. The trade-off is you give up *reliable recoverability*. Optimizations such as last agent commit are not that uncommon and implemented in JTA implementations in the major app servers. As for information about the black art of JTA/JTS see the book 'Java Transaction Service' by Mark Little and co. An outstanding reference straight from the horse's mouth. -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: Tom Barnes
- Posted on: January 29 2009 17:47 EST
- in response to Satadru Roy
Actually it's not entirely true that you cannot use JTA unless all participants are XA-aware. Quite a few JTA implementations offer optimizations where one participant, at most, can be a non XA RM participating in a 2pc transaction. The trade-off is you give up *reliable recoverability*. Optimizations such as last agent commit are not that uncommon and implemented in JTA implementations in the major app servers.
And actually it's not entirely true that there's trade-off where "you give up *reliable recoverability*" when there's a single non-XA participant in an XA transaction. WebLogic Server, OC4J Application Server, and WebSphere provide an enhancement to the last agent commit optimization that yields fully ACID transactions when a transaction has 1 or more XA capable participating resource plus a single non-XA capable JDBC resource. In WebLogic, the feature is fairly transparent - it's a checkbox on the JDBC datasource configuration - and is called "Logging Last Resource". It's documented here Understanding the Logging Last Resource Transaction Option and here Logging Last Resource Transaction Optimization.
As for information about the black art of JTA/JTS see the book 'Java Transaction Service' by Mark Little and co. An outstanding reference straight from the horse's mouth. -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: Satadru Roy
- Posted on: February 02 2009 15:16 EST
- in response to Tom Barnes
Thanks for the information, Tom - I wasn't aware of LLR! I have a question - what happens when the local transaction commits but the app server/network crashes before the response from the non-XA resource is received? When the app server comes back up how does it know the non xa resource actually committed? Btw, where is Zach these days? I still remember some of the WLS JMS internals presentations he had made for the various engineering support teams - they were awesome! -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: Tom Barnes
- Posted on: February 03 2009 10:10 EST
- in response to Satadru Roy
Thanks for the information, Tom - I wasn't aware of LLR! I have a question - what happens when the local transaction commits but the app server/network crashes before the response from the non-XA resource is received? When the app server comes back up how does it know the non xa resource actually committed?
I think this is already somewhat covered in the doc links:
Under the covers, the LLR participant "secretly" inserts a transaction record into a database table as part of the internal JDBC local transaction - unbeknown to the calling application. During a crash recovery, the transaction manager communicates with the LLR participant in order to discover the status of in-doubt transactions. If the transaction record exists, the XA participants of the transaction are committed; if it doesn't these participants are rolled back.Btw, where is Zach these days? I still remember some of the WLS JMS internals presentations he had made for the various engineering support teams - they were awesome!
Zach's moved on to different pastures - I haven't been in touch with him recently. -
Re: Java Pseudo Transactions With Non-Transactional Resources[ Go to top ]
- Posted by: Tom Barnes
- Posted on: February 03 2009 10:21 EST
- in response to Tom Barnes
It looks like the LLR links above have temporarily gone away. Meanwhile, try: http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jta/llr.html http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jdbc_admin/jdbc_datasources.html#wp1142266 -
links[ Go to top ]
- Posted by: matt coleman
- Posted on: December 03 2012 23:54 EST
- in response to Tom Barnes
Hey, thanks for the links you shared here..its helps a kit