List of usage examples for javax.jms XAConnectionFactory createXAConnection
XAConnection createXAConnection() throws JMSException;
From source file:org.bytesoft.bytejta.supports.serialize.XAResourceDeserializerImpl.java
private XAResource deserializeResource(String identifier, Object bean) throws Exception { if (DataSourceHolder.class.isInstance(bean)) { DataSourceHolder holder = (DataSourceHolder) bean; RecoveredResource xares = new RecoveredResource(); xares.setDataSource(holder.getDataSource()); return xares; } else if (javax.sql.DataSource.class.isInstance(bean)) { javax.sql.DataSource dataSource = (javax.sql.DataSource) bean; RecoveredResource xares = new RecoveredResource(); xares.setDataSource(dataSource); return xares; } else if (XADataSource.class.isInstance(bean)) { XADataSource xaDataSource = (XADataSource) bean; XAConnection xaConnection = null; try {//from ww w . j a v a2 s . c o m xaConnection = xaDataSource.getXAConnection(); return xaConnection.getXAResource(); } finally { this.closeQuietly(xaConnection); } } else if (XAConnectionFactory.class.isInstance(bean)) { XAConnectionFactory connectionFactory = (XAConnectionFactory) bean; javax.jms.XAConnection xaConnection = null; XASession xaSession = null; try { xaConnection = connectionFactory.createXAConnection(); xaSession = xaConnection.createXASession(); return xaSession.getXAResource(); } finally { this.closeQuietly(xaSession); this.closeQuietly(xaConnection); } } else if (ManagedConnectionFactory.class.isInstance(bean)) { ManagedConnectionFactory connectionFactory = (ManagedConnectionFactory) bean; ManagedConnection managedConnection = null; try { managedConnection = connectionFactory.createManagedConnection(null, null); return managedConnection.getXAResource(); } finally { this.closeQuietly(managedConnection); } } else { return null; } }