mirror of https://github.com/apache/activemq.git
Update spring pooled bean and config files to use non-deprecated calls. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1452985 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a34fbb909c
commit
931ca1882e
|
@ -23,7 +23,6 @@ import javax.transaction.TransactionManager;
|
|||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.commons.pool.ObjectPoolFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +54,6 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
private int maximumActive = 500;
|
||||
private Object transactionManager;
|
||||
private String resourceName;
|
||||
private ObjectPoolFactory poolFactory;
|
||||
|
||||
public int getMaxConnections() {
|
||||
return maxConnections;
|
||||
|
@ -97,14 +95,6 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
this.connectionFactory = connectionFactory;
|
||||
}
|
||||
|
||||
public ObjectPoolFactory getPoolFactory() {
|
||||
return poolFactory;
|
||||
}
|
||||
|
||||
public void setPoolFactory(ObjectPoolFactory poolFactory) {
|
||||
this.poolFactory = poolFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
|
@ -119,9 +109,8 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
f.setName(resourceName);
|
||||
f.setTransactionManager((TransactionManager) transactionManager);
|
||||
f.setMaxConnections(maxConnections);
|
||||
f.setMaximumActive(maximumActive);
|
||||
f.setMaximumActiveSessionPerConnection(maximumActive);
|
||||
f.setConnectionFactory(connectionFactory);
|
||||
f.setPoolFactory(poolFactory);
|
||||
this.pooledConnectionFactory = f;
|
||||
} catch (Throwable t) {
|
||||
LOGGER.debug("Could not create JCA enabled connection factory: " + t, t);
|
||||
|
@ -133,9 +122,8 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
XaPooledConnectionFactory f = new XaPooledConnectionFactory();
|
||||
f.setTransactionManager((TransactionManager) transactionManager);
|
||||
f.setMaxConnections(maxConnections);
|
||||
f.setMaximumActive(maximumActive);
|
||||
f.setMaximumActiveSessionPerConnection(maximumActive);
|
||||
f.setConnectionFactory(connectionFactory);
|
||||
f.setPoolFactory(poolFactory);
|
||||
this.pooledConnectionFactory = f;
|
||||
} catch (Throwable t) {
|
||||
LOGGER.debug("Could not create XA enabled connection factory: " + t, t);
|
||||
|
@ -146,9 +134,8 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
LOGGER.debug("Trying to build a PooledConnectionFactory");
|
||||
PooledConnectionFactory f = new PooledConnectionFactory();
|
||||
f.setMaxConnections(maxConnections);
|
||||
f.setMaximumActive(maximumActive);
|
||||
f.setMaximumActiveSessionPerConnection(maximumActive);
|
||||
f.setConnectionFactory(connectionFactory);
|
||||
f.setPoolFactory(poolFactory);
|
||||
this.pooledConnectionFactory = f;
|
||||
} catch (Throwable t) {
|
||||
LOGGER.debug("Could not create pooled connection factory: " + t, t);
|
||||
|
@ -173,14 +160,17 @@ public class PooledConnectionFactoryBean implements FactoryBean {
|
|||
}
|
||||
|
||||
// FactoryBean methods
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
return pooledConnectionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getObjectType() {
|
||||
return ConnectionFactory.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
|
||||
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
|
||||
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
|
||||
|
||||
<amq:broker brokerName="test" useJmx="true" persistent="false">
|
||||
<amq:managementContext>
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
<bean id="connectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
|
||||
<property name="maxConnections" value="100"/>
|
||||
<property name="maximumActive" value="50"/>
|
||||
<property name="maximumActiveSessionPerConnection" value="50"/>
|
||||
<property name="connectionFactory">
|
||||
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="tcp://localhost:61616"/>
|
||||
|
@ -66,4 +66,4 @@
|
|||
<property name="transactionManager" ref="transactionManager"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
Loading…
Reference in New Issue