git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@646258 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-04-09 10:23:59 +00:00
parent 5660ebc8f2
commit 5c7374bfae
1 changed files with 12 additions and 1 deletions

View File

@ -52,6 +52,7 @@ public class PooledConnectionFactory implements ConnectionFactory, Service {
private int maximumActive = 500; private int maximumActive = 500;
private int maxConnections = 1; private int maxConnections = 1;
private TransactionManager transactionManager; private TransactionManager transactionManager;
private int idleTimeout = 30 * 1000;
public PooledConnectionFactory() { public PooledConnectionFactory() {
this(new ActiveMQConnectionFactory()); this(new ActiveMQConnectionFactory());
@ -114,7 +115,9 @@ public class PooledConnectionFactory implements ConnectionFactory, Service {
} }
protected ConnectionPool createConnectionPool(ActiveMQConnection connection) { protected ConnectionPool createConnectionPool(ActiveMQConnection connection) {
return new ConnectionPool(connection, getPoolFactory(), transactionManager); ConnectionPool result = new ConnectionPool(connection, getPoolFactory(), transactionManager);
result.setIdleTimeout(getIdleTimeout());
return result;
} }
protected ActiveMQConnection createConnection(ConnectionKey key) throws JMSException { protected ActiveMQConnection createConnection(ConnectionKey key) throws JMSException {
@ -191,4 +194,12 @@ public class PooledConnectionFactory implements ConnectionFactory, Service {
protected ObjectPoolFactory createPoolFactory() { protected ObjectPoolFactory createPoolFactory() {
return new GenericObjectPoolFactory(null, maximumActive); return new GenericObjectPoolFactory(null, maximumActive);
} }
public int getIdleTimeout() {
return idleTimeout;
}
public void setIdleTimeout(int idleTimeout) {
this.idleTimeout = idleTimeout;
}
} }