git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1452979 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-03-05 20:19:51 +00:00
parent c46c040122
commit a34fbb909c
3 changed files with 5 additions and 49 deletions

View File

@ -21,25 +21,18 @@ import javax.transaction.xa.XAResource;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ra.LocalAndXATransaction;
import org.apache.commons.pool.ObjectPoolFactory;
import org.apache.geronimo.transaction.manager.WrapperNamedXAResource;
public class JcaConnectionPool extends XaConnectionPool {
private String name;
private final String name;
public JcaConnectionPool(ActiveMQConnection connection, TransactionManager transactionManager, String name) {
super(connection, transactionManager);
this.name = name;
}
/**
* @deprecated
*/
public JcaConnectionPool(ActiveMQConnection connection, ObjectPoolFactory poolFactory, TransactionManager transactionManager, String name) {
this(connection, transactionManager, name);
}
@Override
protected XAResource createXaResource(PooledSession session) throws JMSException {
XAResource xares = new LocalAndXATransaction(session.getInternalSession().getTransactionContext());
if (name != null) {
@ -47,5 +40,4 @@ public class JcaConnectionPool extends XaConnectionPool {
}
return xares;
}
}

View File

@ -28,7 +28,6 @@ import org.apache.activemq.Service;
import org.apache.activemq.util.JMSExceptionSupport;
import org.apache.commons.pool.KeyedObjectPool;
import org.apache.commons.pool.KeyedPoolableObjectFactory;
import org.apache.commons.pool.ObjectPoolFactory;
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -235,13 +234,6 @@ public class PooledConnectionFactory implements ConnectionFactory, Service {
return new PooledConnection(connection);
}
/**
* @deprecated
*/
public ObjectPoolFactory<?> getPoolFactory() {
return null;
}
protected ActiveMQConnection createConnection(ConnectionKey key) throws JMSException {
if (key.getUserName() == null && key.getPassword() == null) {
return (ActiveMQConnection)connectionFactory.createConnection();
@ -292,22 +284,6 @@ public class PooledConnectionFactory implements ConnectionFactory, Service {
this.connectionsPool.clear();
}
/**
* @deprecated use {@link #getMaximumActiveSessionPerConnection()}
*/
@Deprecated
public int getMaximumActive() {
return getMaximumActiveSessionPerConnection();
}
/**
* @deprecated use {@link #setMaximumActiveSessionPerConnection(int)}
*/
@Deprecated
public void setMaximumActive(int maximumActive) {
setMaximumActiveSessionPerConnection(maximumActive);
}
/**
* Returns the currently configured maximum number of sessions a pooled Connection will
* create before it either blocks or throws an exception when a new session is requested,
@ -479,12 +455,6 @@ public class PooledConnectionFactory implements ConnectionFactory, Service {
return this.connectionsPool.getNumIdle();
}
/**
* @deprecated
*/
public void setPoolFactory(ObjectPoolFactory<?> factory) {
}
/**
* Delegate that creates each instance of an ConnectionPool object. Subclasses can override
* this method to customize the type of connection pool returned.

View File

@ -25,7 +25,6 @@ import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
import org.apache.activemq.ActiveMQConnection;
import org.apache.commons.pool.ObjectPoolFactory;
/**
* An XA-aware connection pool. When a session is created and an xa transaction is active,
@ -35,20 +34,13 @@ import org.apache.commons.pool.ObjectPoolFactory;
*/
public class XaConnectionPool extends ConnectionPool {
private TransactionManager transactionManager;
private final TransactionManager transactionManager;
public XaConnectionPool(ActiveMQConnection connection, TransactionManager transactionManager) {
super(connection);
this.transactionManager = transactionManager;
}
/**
* @deprecated
*/
public XaConnectionPool(ActiveMQConnection connection, ObjectPoolFactory poolFactory, TransactionManager transactionManager) {
this(connection, transactionManager);
}
@Override
public Session createSession(boolean transacted, int ackMode) throws JMSException {
try {
@ -90,9 +82,11 @@ public class XaConnectionPool extends ConnectionPool {
this.session = session;
}
@Override
public void beforeCompletion() {
}
@Override
public void afterCompletion(int status) {
try {
// This will return session to the pool.