views:

241

answers:

1

I'm writing a Resource Adaptor which does not support two phase commit. I know there is an optimization technique called: "Last Resource Optimization".

On JBoss your XAResource class should implement LastResource in order to have the optimization.

My question is: how this can be done in WebLogic, WebSpehre, Glassfish, etc...

+2  A: 

Weblogic: AFAIK (may be very wrong) only JDBC drivers can be used with LRO, and it's a purely administrative task. When a driver doesn't support XA, it can be configured to be used with LRO: "Select this option if you want to enable non-XA JDBC connections from the data source to emulate participation in global transactions using JTA".

Essentially, LRO tolerates a resource that has no prepare phase, and can only be committed or rolled back. Thus, if only one such resource exist in XA-transaction, we may first attempt to prepare all others, then commit that LRO one, then, if succeed, commit others, otherwise rollback others.

You see, there is no special need in declaring any interface. It's an algorithm that can work with any non-XA resource. I'm not sure why JBoss has it, but I don't expect other servers have something similar.

Vladimir Dyuzhev