Cool about all the stuff you have done. Can't wait to take a look at it once
you commit it.
I am not sure I understand what you mean by "locking." Could you explain?
Upon thinking about the conflict between the context transaction and the mi
transaction, I think I ran into an area where I'll have to consumt the spec.
Specifically, what happens if you call a BMT bean from a CMT bean? When you
call utx.begin(), does that suspend the transaction from the CMT bean, only to
come back into scope when you commit() or rollback() the utx? What if you
never call commit() or rollback()? Yikes! Anyway I can start to see the
problem here.
As far as the distributes stuff, I have been looking at how JTS does it (CO
transactions), as well as how JoNaS does it. The JoNaS code is kind of
spaghettified, but their concept is sound, and simple. Basicacally, every
transaction has a coordinater and zero or more sub-coordinators. These are
actually objects that are wrappers around a Transaction implementation, and
have a 1-to-1 relationship with a transaction. There is one coordinater per
transaction per machine. These coordinators are all rmi-accessible objects.
A transaction's coordinator is effectively the TransactionManager that created
the transaction. As the transaction propagates to other machines, it carries a
remote reference to its Coordinator along with it. As it goes to another
machine, it would pick up a sub-coordinator that is registered with the main
coordinator. This could happen in the call to TxManager.associateThread().
Then, when the transaction is committed, the commit is sent to the main
coordinator, which asks all the sub-coordinators to "vote" for rollback or
commit, and then action is taken accordingly. Of course you \only commit on a
unanimous vote to commit.
It sounds complicated, but looking at the JoNaS code it is not all that
heinous. The only real problem is that since JDBC doesn't support a true
2-phase commit, you coudl theoretically get a partially committed
transaction...prepare() will always return a true, but your commit might fail
halfway thru. But I think everyone has this problem.
-Charles