You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/10/19 19:06:29 UTC
svn commit: r465682 -
/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java
Author: chirino
Date: Thu Oct 19 10:06:27 2006
New Revision: 465682
URL: http://svn.apache.org/viewvc?view=rev&rev=465682
Log:
Ensure that the connection info sent to the broker before doing XA operations.
Modified:
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java?view=diff&rev=465682&r1=465681&r2=465682
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java Thu Oct 19 10:06:27 2006
@@ -381,7 +381,8 @@
}
public void rollback(Xid xid) throws XAException {
- if( log.isDebugEnabled() )
+
+ if( log.isDebugEnabled() )
log.debug("Rollback: "+xid);
// We allow interleaving multiple transactions, so
@@ -399,6 +400,9 @@
}
try {
+ this.connection.checkClosedOrFailed();
+ this.connection.ensureConnectionInfoSent();
+
// Let the server know that the tx is rollback.
TransactionInfo info = new TransactionInfo(getConnectionId(), x, TransactionInfo.ROLLBACK);
this.connection.syncSendPacket(info);
@@ -435,6 +439,8 @@
try {
+ this.connection.checkClosedOrFailed();
+ this.connection.ensureConnectionInfoSent();
// Notify the server that the tx was committed back
TransactionInfo info = new TransactionInfo(getConnectionId(), x,
@@ -504,7 +510,10 @@
TransactionInfo info = new TransactionInfo(getConnectionId(), null, TransactionInfo.RECOVER);
try {
- DataArrayResponse receipt = (DataArrayResponse) this.connection.syncSendPacket(info);
+ this.connection.checkClosedOrFailed();
+ this.connection.ensureConnectionInfoSent();
+
+ DataArrayResponse receipt = (DataArrayResponse) this.connection.syncSendPacket(info);
return (XATransactionId[]) receipt.getData();
} catch (JMSException e) {
throw toXAException(e);
@@ -529,7 +538,15 @@
}
private void setXid(Xid xid) throws XAException {
- if (xid != null) {
+
+ try {
+ this.connection.checkClosedOrFailed();
+ this.connection.ensureConnectionInfoSent();
+ } catch (JMSException e) {
+ throw toXAException(e);
+ }
+
+ if (xid != null) {
// associate
associatedXid = xid;
transactionId = new XATransactionId(xid);