1 22 package org.jboss.resource.connectionmanager; 23 24 import javax.management.ObjectName ; 25 import javax.transaction.xa.XAException ; 26 27 import org.jboss.logging.Logger; 28 import org.jboss.system.ServiceMBeanSupport; 29 import org.jboss.tm.XAExceptionFormatter; 30 31 39 40 public class JBossLocalXAExceptionFormatter extends ServiceMBeanSupport 41 implements XAExceptionFormatter, JBossLocalXAExceptionFormatterMBean 42 { 43 private ObjectName transactionManagerService; 44 45 public JBossLocalXAExceptionFormatter() 46 { 47 } 48 49 public ObjectName getTransactionManagerService() 50 { 51 return transactionManagerService; 52 } 53 54 public void setTransactionManagerService(ObjectName transactionManagerService) 55 { 56 this.transactionManagerService = transactionManagerService; 57 } 58 59 protected void startService() throws Exception 60 { 61 getServer().invoke(transactionManagerService, "registerXAExceptionFormatter", 62 new Object [] { JBossLocalXAException.class, this }, 63 new String [] { Class .class.getName(), XAExceptionFormatter.class.getName() } 64 ); 65 } 66 67 protected void stopService() throws Exception 68 { 69 getServer().invoke(transactionManagerService, "unregisterXAExceptionFormatter", 70 new Object [] { JBossLocalXAException.class }, 71 new String [] { Class .class.getName() } 72 ); 73 } 74 75 public void formatXAException(XAException xae, Logger log) 76 { 77 try 78 { 79 log.warn("JBoss Local XA wrapper error: ", ((JBossLocalXAException) xae).getCause()); 80 } 81 catch (Exception e) 82 { 83 log.warn("Problem trying to format XAException: ", e); 84 } 85 } 86 } 87 | Popular Tags |