The default Transaction Manager implementation.
A CRM is responsible for converting local transactions from/to a form that can be serialized so it can be passed over the wire to another Java VM.
The JTA specification does not define the CRM, so we have implemented our own.
The J2EE specification suggests that the CRM used is the OTS CosTSPortability CRM, but that depends heavily on CORBA, and JBoss is not dependent on any particular object request broker technology, so we do not use that.
The advantage of using our own CRM implementation instead of CosTSPortablilty is twofold:
In JBoss everything is a MBean. Implementing your JTA implementation as an MBean makes it simpler to manage it in a standardized way.
Since your JTA implementation is a service you probably want to make your MBean implemementation extend fromorg.jboss.system.ServiceMBeanSupport
.
When running in the server, your MBean should publish three objects
in JNDI:
javax.transaction.TransactionManager
.
This is the standard JTA transaction manager that the JBoss server
uses to control transactions.
org.jboss.tm.TransactionPropagationContextImporter
.
This is used by the JBoss communication layers to convert the wire
representation of a transaction to a
javax.transaction.Transaction
instance that can be used
locally.
org.jboss.tm.TransactionPropagationContextFactory
.
This is used by the JBoss communication layers to convert the wire
representation of a javax.transaction.Transaction
instance to a form that can be passed over the wire to another JBoss
server.
See the implementation of
org.jboss.tm.TransactionManagerService
for an example of
such a MBean. Please note that the three names your MBean should publish
in JNDI need not refer to the same object instance as the
TransactionManagerService
does.
Please note that the transaction propagation context (TPC) used by
the CRM interfaces TransactionPropagationContextImporter
and TransactionPropagationContextFactory
is of type
java.lang.Object
. This allows for the widest range of
possible TPC implementations. For your TPC to work with the JBoss
JRMP transport, it should be Java-serializable at runtime.