1 17 18 package org.apache.geronimo.connector.outbound.transactionlog; 19 20 import javax.resource.ResourceException ; 21 22 import org.apache.geronimo.connector.outbound.ConnectionInfo; 23 import org.apache.geronimo.connector.outbound.ConnectionInterceptor; 24 import org.apache.geronimo.connector.outbound.ConnectionReturnAction; 25 import org.apache.geronimo.connector.outbound.ManagedConnectionInfo; 26 27 34 public class LogXAResourceInsertionInterceptor 35 implements ConnectionInterceptor { 36 37 private final ConnectionInterceptor next; 38 private final String name; 39 40 public LogXAResourceInsertionInterceptor(final ConnectionInterceptor next, String name) { 41 this.next = next; 42 this.name = name; 43 } 44 45 public void getConnection(ConnectionInfo connectionInfo) throws ResourceException { 46 next.getConnection(connectionInfo); 47 ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo(); 48 mci.setXAResource( 49 new LogXAResource( 50 mci.getManagedConnection().getLocalTransaction(), name)); 51 } 52 53 public void returnConnection( 54 ConnectionInfo connectionInfo, 55 ConnectionReturnAction connectionReturnAction) { 56 next.returnConnection(connectionInfo, connectionReturnAction); 57 } 58 59 public void destroy() { 60 next.destroy(); 61 } 62 } 63 | Popular Tags |