if (trace)
log.trace("Using a non-XA TopicConnection. " +
"It will not be able to participate in a Global UOW");
}
else
throw new JBossResourceException("Connection was not recognizable: " + con);
if (trace)
log.trace("xaTopicSession=" + xaTopicSession + ", topicSession=" + topicSession);
}
else if (info.getType() == JmsConnectionFactory.QUEUE)
{
String jndi = adapter.getQueueFactoryRef();
if (jndi == null)
throw new IllegalStateException("No configured 'QueueFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
factory = context.lookup(jndi);
con = ConnectionFactoryHelper.createQueueConnection(factory, user, pwd);
if (info.getClientID() != null)
con.setClientID(info.getClientID());
con.setExceptionListener(this);
if (trace)
log.debug("created connection: " + con);
if (con instanceof XAQueueConnection)
{
xaQueueSession =
((XAQueueConnection)con).createXAQueueSession();
queueSession = xaQueueSession.getQueueSession();
xaTransacted = true;
}
else if (con instanceof QueueConnection)
{
queueSession =
((QueueConnection)con).createQueueSession(transacted, ack);
if (trace)
log.trace("Using a non-XA QueueConnection. " +
"It will not be able to participate in a Global UOW");
}
else
throw new JBossResourceException("Connection was not reconizable: " + con);
if (trace)
log.trace("xaQueueSession=" + xaQueueSession + ", queueSession=" + queueSession);
}
else
{
String jndi = adapter.getFactoryRef();
if (jndi == null)
throw new IllegalStateException("No configured 'FactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
factory = context.lookup(jndi);
con = ConnectionFactoryHelper.createConnection(factory, user, pwd);
if (info.getClientID() != null)
con.setClientID(info.getClientID());
con.setExceptionListener(this);
if (trace)
log.trace("created connection: " + con);
if (con instanceof XAConnection)
{
xaSession =
((XAConnection)con).createXASession();
session = xaSession.getSession();
xaTransacted = true;
}
else
{
session = con.createSession(transacted, ack);
if (trace)
log.trace("Using a non-XA Connection. " +
"It will not be able to participate in a Global UOW");
}
if (trace)
log.debug("xaSession=" + xaQueueSession + ", Session=" + session);
}
if (trace)
log.debug("transacted=" + transacted + ", ack=" + ack);
}
catch (NamingException e)
{
throw new JBossResourceException("Unable to setup connection", e);
}
catch (JMSException e)
{
throw new JBossResourceException("Unable to setup connection", e);
}
}