summaryrefslogtreecommitdiff
path: root/qpid/java/jca
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2012-01-10 15:03:22 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2012-01-10 15:03:22 +0000
commitcf2c7eb9b042a8d9090a0eb2f9ef173b3a905f70 (patch)
tree44344f7e796d35ee3ab37346f69a4789f59203a5 /qpid/java/jca
parenta45ef29c38bc886447611e42af013e0315bd6294 (diff)
downloadqpid-python-cf2c7eb9b042a8d9090a0eb2f9ef173b3a905f70.tar.gz
QPID-3733, committing patch from Weston Price.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1229578 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/jca')
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnection.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnection.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnection.java
index fb1b7f060c..16891290ae 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnection.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnection.java
@@ -752,26 +752,25 @@ public class QpidRAManagedConnection implements ManagedConnection, ExceptionList
try
{
- boolean transacted = _cri.isTransacted();
- int acknowledgeMode = Session.AUTO_ACKNOWLEDGE;
- boolean localTx = _mcf.getUseLocalTx();
+ boolean transacted = _cri.isTransacted() || _mcf.getUseLocalTx();
+ int acknowledgeMode = (transacted) ? Session.SESSION_TRANSACTED : _cri.getAcknowledgeMode();
if (_cri.getType() == QpidRAConnectionFactory.TOPIC_CONNECTION)
{
if (_userName != null && _password != null)
{
- if(!localTx)
+ if(!transacted)
{
_connection = _mcf.getCleanAMQConnectionFactory().createXATopicConnection(_userName, _password);
}
else
{
- _connection = _mcf.getCleanAMQConnectionFactory().createTopicConnection();
+ _connection = _mcf.getCleanAMQConnectionFactory().createTopicConnection(_userName, _password);
}
}
else
{
- if(!localTx)
+ if(!transacted)
{
_connection = _mcf.getDefaultAMQConnectionFactory().createXATopicConnection();
}
@@ -781,32 +780,31 @@ public class QpidRAManagedConnection implements ManagedConnection, ExceptionList
}
}
- if(!localTx)
+ if(!transacted)
{
_xaSession = ((XATopicConnection)_connection).createXATopicSession();
-
}
else
{
- _session = ((TopicConnection)_connection).createTopicSession(localTx, acknowledgeMode);
+ _session = ((TopicConnection)_connection).createTopicSession(transacted, acknowledgeMode);
}
}
else if (_cri.getType() == QpidRAConnectionFactory.QUEUE_CONNECTION)
{
if (_userName != null && _password != null)
{
- if(!localTx)
+ if(!transacted)
{
_connection = _mcf.getCleanAMQConnectionFactory().createXAQueueConnection(_userName, _password);
}
else
{
- _connection = _mcf.getCleanAMQConnectionFactory().createQueueConnection();
+ _connection = _mcf.getCleanAMQConnectionFactory().createQueueConnection(_userName, _password);
}
}
else
{
- if(!localTx)
+ if(!transacted)
{
_connection = _mcf.getDefaultAMQConnectionFactory().createXAQueueConnection();
}
@@ -816,14 +814,14 @@ public class QpidRAManagedConnection implements ManagedConnection, ExceptionList
}
}
- if(!localTx)
+ if(!transacted)
{
_xaSession = ((XAQueueConnection)_connection).createXAQueueSession();
}
else
{
- _session = ((QueueConnection)_connection).createQueueSession(localTx, acknowledgeMode);
+ _session = ((QueueConnection)_connection).createQueueSession(transacted, acknowledgeMode);
}
}
@@ -831,18 +829,18 @@ public class QpidRAManagedConnection implements ManagedConnection, ExceptionList
{
if (_userName != null && _password != null)
{
- if(!localTx)
+ if(!transacted)
{
_connection = _mcf.getCleanAMQConnectionFactory().createXAConnection(_userName, _password);
}
else
{
- _connection = _mcf.getCleanAMQConnectionFactory().createConnection();
+ _connection = _mcf.getCleanAMQConnectionFactory().createConnection(_userName, _password);
}
}
else
{
- if(!localTx)
+ if(!transacted)
{
_connection = _mcf.getDefaultAMQConnectionFactory().createXAConnection();
}
@@ -852,22 +850,24 @@ public class QpidRAManagedConnection implements ManagedConnection, ExceptionList
}
}
- if(!localTx)
+ if(!transacted)
{
_xaSession = ((XAQueueConnection)_connection).createXASession();
}
else
{
- _session = ((QueueConnection)_connection).createSession(localTx, acknowledgeMode);
+ _session = ((QueueConnection)_connection).createSession(transacted, acknowledgeMode);
}
}
_connection.setExceptionListener(this);
+
}
catch (JMSException je)
{
+ _log.error(je.getMessage(), je);
throw new ResourceException(je.getMessage(), je);
}
}