#229 Client side jmx && dtm

David Jencks
JBossTX (1)
David Jencks

I've implemented jboss using a client side mbean server. I'm
using it for the infrastructure for transaction transport for
distributed transactions.

To get the jboss mbean server for your jvm, call
org.jboss.system.client.Client.getMBeanServer. If you are in a
server, you will get that mbean server: if you are on a client, it will
start a server if necessary, and return it.

An example of setting up mbeans in the client side mbean server
is in org.jboss.invocation.trunk.client.ClientSetup. This creates
the mbeans, sets up their dependencies, and creates and starts
them. This is equivalent to what the jboss mbean deployment
framework does.

The mbeans consist of several components for the TrunkInvoker
client side, eliminating the need for static references, and several
components that comprise a new client side UserTransaction
implementation. This UserTransaction implementation has a
simplified TransactionManager and Transaction that can handle
only one branch of a transaction, but work based on xids. The
transaction propagation to the server is based on exposing the
invoker as an XAResource, to get the xid from the transaction: the
xid then travels with the invocation and is imported using the jca
1.5 Work contracts. The prepare/commit/rollback/recover method
calls are also now sent over the trunk invoker.

This framework is designed so that when the client side of the
trunk invoker is on another jboss instance the transaction
manager will treat the trunk invoker as just another xaresource,
thus providing at long last distributed transactions in jboss.

Some parts of this implementation are somewhat sketchy and
untested: in particular the exception handling in the client side
transaction manager is not finished.