}
public XAStatefulHolder createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception {
if (!(xaFactory instanceof XAConnectionFactory))
throw new IllegalArgumentException("class '" + xaFactory.getClass().getName() + "' does not implement " + XAConnectionFactory.class.getName());
XAConnectionFactory xaConnectionFactory = (XAConnectionFactory) xaFactory;
XAConnection xaConnection;
if (user == null || password == null) {
if (log.isDebugEnabled()) { log.debug("creating new JMS XAConnection with no credentials"); }
xaConnection = xaConnectionFactory.createXAConnection();
}
else {
if (log.isDebugEnabled()) { log.debug("creating new JMS XAConnection with user <" + user + "> and password <" + password + ">"); }
xaConnection = xaConnectionFactory.createXAConnection(user, password);
}
JmsPooledConnection jmsPooledConnection = new JmsPooledConnection(this, xaConnection);
xaStatefulHolders.add(jmsPooledConnection);
return jmsPooledConnection;