mirror of https://github.com/apache/activemq.git
allow xapooledconnectionfactory as an admin object - allows xa enlistment at the session level for jms style use cases with the RAR contents. validation of https://issues.apache.org/jira/browse/AMQ-3560 in eap 6.1
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1508958 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
708be6d822
commit
55a8ef54b5
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.activemq.pool;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.jms.Connection;
|
||||
|
@ -25,6 +26,7 @@ import javax.jms.JMSException;
|
|||
import org.apache.activemq.ActiveMQConnection;
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.Service;
|
||||
import org.apache.activemq.jndi.JNDIBaseStorable;
|
||||
import org.apache.activemq.util.JMSExceptionSupport;
|
||||
import org.apache.commons.pool.KeyedObjectPool;
|
||||
import org.apache.commons.pool.KeyedPoolableObjectFactory;
|
||||
|
@ -62,7 +64,7 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
* @org.apache.xbean.XBean element="pooledConnectionFactory"
|
||||
*/
|
||||
public class PooledConnectionFactory implements ConnectionFactory, Service {
|
||||
public class PooledConnectionFactory extends JNDIBaseStorable implements ConnectionFactory, Service {
|
||||
private static final transient Logger LOG = LoggerFactory.getLogger(PooledConnectionFactory.class);
|
||||
|
||||
private final AtomicBoolean stopped = new AtomicBoolean(false);
|
||||
|
@ -484,4 +486,16 @@ public class PooledConnectionFactory implements ConnectionFactory, Service {
|
|||
protected ConnectionPool createConnectionPool(ActiveMQConnection connection) {
|
||||
return new ConnectionPool(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildFromProperties(Properties props) {
|
||||
ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();
|
||||
activeMQConnectionFactory.buildFromProperties(props);
|
||||
connectionFactory = activeMQConnectionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateProperties(Properties props) {
|
||||
((ActiveMQConnectionFactory)connectionFactory).populateProperties(props);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.activemq.pool;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.QueueConnection;
|
||||
import javax.jms.QueueConnectionFactory;
|
||||
|
@ -161,4 +162,21 @@ public class XaPooledConnectionFactory extends PooledConnectionFactory implement
|
|||
public TopicConnection createTopicConnection(String userName, String password) throws JMSException {
|
||||
return (TopicConnection) createConnection(userName, password);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildFromProperties(Properties props) {
|
||||
super.buildFromProperties(props);
|
||||
for (String v : new String[]{"tmFromJndi", "tmJndiName"}) {
|
||||
if (props.containsKey(v)) {
|
||||
IntrospectionSupport.setProperty(this, v, props.getProperty(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateProperties(Properties props) {
|
||||
super.populateProperties(props);
|
||||
props.setProperty("tmFromJndi", String.valueOf(isTmFromJndi()));
|
||||
props.setProperty("tmJndiName", tmJndiName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -335,6 +335,10 @@
|
|||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-pool</groupId>
|
||||
<artifactId>commons-pool</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
|
|
|
@ -174,6 +174,19 @@
|
|||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
</adminobject>
|
||||
<adminobject>
|
||||
<adminobject-interface>javax.jms.ConnectionFactory</adminobject-interface>
|
||||
<adminobject-class>org.apache.activemq.pool.XaPooledConnectionFactory</adminobject-class>
|
||||
<config-property>
|
||||
<config-property-name>brokerUrl</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
<config-property>
|
||||
<config-property-name>tmFromJndi</config-property-name>
|
||||
<config-property-type>java.lang.Boolean</config-property-type>
|
||||
</config-property>
|
||||
</adminobject>
|
||||
|
||||
|
||||
</resourceadapter>
|
||||
</connector>
|
||||
|
|
Loading…
Reference in New Issue