ignore transacted and ack mode in the rar - closer to jms 2.0 semantics and fixes tck cached connection issues. in the absense of a transaction their will never be a commit so using a local transaction is totally broken. transactions come from rar local or xa or none

This commit is contained in:
gtully 2014-03-14 23:24:33 +00:00
parent 4e79e43905
commit adb49f5627
2 changed files with 5 additions and 4 deletions

View File

@ -112,10 +112,7 @@ public class ManagedConnectionProxy implements Connection, QueueConnection, Topi
* @throws JMSException on error
*/
private ManagedSessionProxy createSessionProxy(boolean transacted, int acknowledgeMode) throws JMSException {
if (!transacted && acknowledgeMode == Session.SESSION_TRANSACTED) {
acknowledgeMode = Session.AUTO_ACKNOWLEDGE;
}
ActiveMQSession session = (ActiveMQSession) getConnection().createSession(transacted, acknowledgeMode);
ActiveMQSession session = (ActiveMQSession) getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
ManagedTransactionContext txContext = new ManagedTransactionContext(managedConnection.getTransactionContext());
session.setTransactionContext(txContext);
ManagedSessionProxy p = new ManagedSessionProxy(session, this);

View File

@ -28,6 +28,7 @@ import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.QueueConnectionFactory;
import javax.jms.Session;
import javax.jms.TopicConnectionFactory;
import javax.resource.Referenceable;
import javax.resource.ResourceException;
@ -88,6 +89,9 @@ public class ManagedConnectionFactoryTest extends TestCase {
assertTrue(connection != null);
assertTrue(connection instanceof ManagedConnectionProxy);
Session session = connection.createSession(true, 0);
assertFalse("transacted attribute is ignored, only transacted with xa or local tx", session.getTransacted());
connection.close();
}