1 22 package org.jboss.resource.adapter.jms; 23 24 import javax.jms.JMSException ; 25 import javax.resource.ResourceException ; 26 import javax.resource.spi.LocalTransaction ; 27 28 import org.jboss.resource.JBossResourceException; 29 30 37 public class JmsLocalTransaction implements LocalTransaction 38 { 39 protected JmsManagedConnection mc; 40 41 public JmsLocalTransaction(final JmsManagedConnection mc) 42 { 43 this.mc = mc; 44 } 45 46 public void begin() throws ResourceException 47 { 48 } 49 50 public void commit() throws ResourceException 51 { 52 try 53 { 54 if (mc.getSession().getTransacted()) 55 mc.getSession().commit(); 56 } 57 catch (JMSException e) 58 { 59 throw new JBossResourceException("Could not commit LocalTransaction", e); 60 } 61 } 62 63 public void rollback() throws ResourceException 64 { 65 try 66 { 67 if (mc.getSession().getTransacted()) 68 mc.getSession().rollback(); 69 } 70 catch (JMSException ex) 71 { 72 throw new JBossResourceException("Could not rollback LocalTransaction", ex); 73 } 74 } 75 } 76 | Popular Tags |