}
public synchronized XAConnection createDataSourceConnection(
String identifier) throws QueryTestFailedException {
DataSource ds = null;
if (identifier != null) {
ds = DataSourceMgr.getInstance().getDataSource(identifier);
}
if (ds == null) {
throw new TransactionRuntimeException(
"Program Error: DataSource is not mapped to Identifier "
+ identifier);
}
XAConnection conn = ds.getXAConnection();
if (conn != null)
return conn;
ConnectionStrategy cs = null;
if (identifier == null) {
cs = new DataSourceConnection(ds.getProperties());
} else {
cs = new DataSourceConnection(ds.getProperties());
}
// conn = cs.getXAConnection();
//
// conn = (XAConnection) Proxy.newProxyInstance(Thread.currentThread()
// .getContextClassLoader(),
// new Class[] { javax.sql.XAConnection.class },
// new CloseInterceptor(conn));
ds.setXAConnection(cs.getXAConnection());
return ds.getXAConnection();
}