import bitronix.tm.TransactionManagerServices; public class MyApp { public static void main(String[] args) { TransactionManagerServices.getConfiguration().build(); UserTransactionManager utm = TransactionManagerServices.getTransactionManager(); utm.begin(); try { Connection conn = dataSource.getConnection(); // ... QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("java:/comp/env/jms/ConnectionFactory"); // ... utm.commit(); } catch (Exception e) { e.printStackTrace(); utm.rollback(); } finally { TransactionManagerServices.getTransactionManager().shutdown(); } } }


上一篇:
下一篇:
切换中文