You can use JMX to inspect and administer active (pending) transactions. This is most relevant for problematic transactions that require the intervention of a human administrator.
The Atomikos JMX administration facility offers a graphical interface to the active transactions in the core. Administrators can use this to perform the following operations:
The following code fragment shows how to configure JMX administration for the built-in JMX in JDK 1.5.
JmxTransactionService service = new JmxTransactionService(); //1 //optionally configure this to set heuristics only: //service.setHeuristicsOnly ( true ); MBeanServer jmx = ManagementFactory.getPlatformMBeanServer(); //2 ObjectName mBeanName = new ObjectName ( "atomikos:type=Transactions" ); //3 jmx.registerMBean ( service , mBeanName ); //4
Assuming that you are using jconsole to connect to the JMX server inside your application's VM: the JMX functionality will show up in the jconsole, under atomikos.
Note that the application needs to specify additional VM parameters to allow jconsole to connect, for instance like this:
java -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1209 -Dcom.sun.management.jmxremote.ssl=false
See http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html for more information on the jconsole utility.
To use another MBeanServer implementation, all you need to do is modify line 2 above to obtain the right MBeanServer instance.