1 22 package org.jboss.resource.connectionmanager; 23 24 import javax.transaction.TransactionManager ; 25 import org.jboss.tm.usertx.client.ServerVMClientUserTransaction; 26 import org.jboss.ejb.EnterpriseContext; 27 28 37 public class CachedConnectionManagerReference 38 { 39 private CachedConnectionManager cachedConnectionManager = new CachedConnectionManager(); 40 private TransactionManager transactionManager; 41 42 public CachedConnectionManager getCachedConnectionManager() 43 { 44 return cachedConnectionManager; 45 } 46 47 public void setCachedConnectionManager(CachedConnectionManager cachedConnectionManager) 48 { 49 this.cachedConnectionManager = cachedConnectionManager; 50 } 51 52 public TransactionManager getTransactionManager() 53 { 54 return transactionManager; 55 } 56 57 public void setTransactionManager(TransactionManager transactionManager) 58 { 59 this.transactionManager = transactionManager; 60 } 61 62 public void start() 63 { 64 TransactionSynchronizer.setTransactionManager(transactionManager); 65 ServerVMClientUserTransaction.getSingleton().registerTxStartedListener(cachedConnectionManager); 66 EnterpriseContext.setUserTransactionStartedListener(cachedConnectionManager); 67 } 68 69 public void stop() 70 { 71 ServerVMClientUserTransaction.getSingleton().unregisterTxStartedListener(cachedConnectionManager); 72 EnterpriseContext.setUserTransactionStartedListener(null); 73 } 74 } 75 | Popular Tags |