Fix for AMQ-1696

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@652111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2008-04-29 20:59:06 +00:00
parent c65a66fe3e
commit aa62069349
2 changed files with 20 additions and 4 deletions

View File

@ -70,7 +70,7 @@ public class ActiveMQConnectionSupport {
* @return the physical connection * @return the physical connection
* @throws JMSException if the connection could not be established * @throws JMSException if the connection could not be established
*/ */
protected ActiveMQConnection makeConnection( public ActiveMQConnection makeConnection(
ActiveMQConnectionRequestInfo connectionRequestInfo, ActiveMQConnectionRequestInfo connectionRequestInfo,
ActiveMQConnectionFactory connectionFactory) throws JMSException ActiveMQConnectionFactory connectionFactory) throws JMSException
{ {

View File

@ -55,7 +55,8 @@ public class ActiveMQResourceAdapter extends ActiveMQConnectionSupport implement
private String brokerXmlConfig; private String brokerXmlConfig;
private BrokerService broker; private BrokerService broker;
private Thread brokerStartThread; private Thread brokerStartThread;
private ActiveMQConnectionFactory connectionFactory;
/** /**
* *
*/ */
@ -98,14 +99,21 @@ public class ActiveMQResourceAdapter extends ActiveMQConnectionSupport implement
* @see org.apache.activemq.ra.MessageResourceAdapter#makeConnection() * @see org.apache.activemq.ra.MessageResourceAdapter#makeConnection()
*/ */
public ActiveMQConnection makeConnection() throws JMSException { public ActiveMQConnection makeConnection() throws JMSException {
return makeConnection(getInfo()); if( connectionFactory == null ) {
return makeConnection(getInfo());
} else {
return makeConnection(getInfo(), connectionFactory);
} }
}
/** /**
* @param activationSpec * @param activationSpec
*/ */
public ActiveMQConnection makeConnection(MessageActivationSpec activationSpec) throws JMSException { public ActiveMQConnection makeConnection(MessageActivationSpec activationSpec) throws JMSException {
ActiveMQConnectionFactory connectionFactory = createConnectionFactory(getInfo()); ActiveMQConnectionFactory connectionFactory = this.connectionFactory;
if (connectionFactory == null) {
connectionFactory = createConnectionFactory(getInfo());
}
String userName = defaultValue(activationSpec.getUserName(), getInfo().getUserName()); String userName = defaultValue(activationSpec.getUserName(), getInfo().getUserName());
String password = defaultValue(activationSpec.getPassword(), getInfo().getPassword()); String password = defaultValue(activationSpec.getPassword(), getInfo().getPassword());
String clientId = activationSpec.getClientId(); String clientId = activationSpec.getClientId();
@ -306,5 +314,13 @@ public class ActiveMQResourceAdapter extends ActiveMQConnectionSupport implement
return result; return result;
} }
public ActiveMQConnectionFactory getConnectionFactory() {
return connectionFactory;
}
public void setConnectionFactory(ActiveMQConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
}
} }