You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/02/02 16:54:59 UTC
svn commit: r1066506 -
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
Author: tabish
Date: Wed Feb 2 15:54:59 2011
New Revision: 1066506
URL: http://svn.apache.org/viewvc?rev=1066506&view=rev
Log:
Improved error handling code in Rollback and Commit handlers.
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs?rev=1066506&r1=1066505&r2=1066506&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs Wed Feb 2 15:54:59 2011
@@ -345,7 +345,7 @@ namespace Apache.NMS.ActiveMQ
AfterRollback();
try
{
- this.session.Connection.OnException(ex);
+ this.connection.OnException(ex);
}
catch (Exception error)
{
@@ -397,7 +397,14 @@ namespace Apache.NMS.ActiveMQ
Tracer.Debug("Transaction Single Phase Commit failed with error: " + ex.Message);
AfterRollback();
enlistment.Done();
- this.session.Connection.OnException(ex);
+ try
+ {
+ this.connection.OnException(ex);
+ }
+ catch (Exception error)
+ {
+ Tracer.Error(error.ToString());
+ }
}
finally
{
@@ -412,35 +419,45 @@ namespace Apache.NMS.ActiveMQ
{
Tracer.Debug("Rollback notification received");
- BeforeEnd();
+ if (this.transactionId != null)
+ {
+ BeforeEnd();
- // Now notify the broker that a new XA'ish transaction has started.
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.session.Connection.ConnectionId;
- info.TransactionId = this.transactionId;
- info.Type = (int)TransactionType.End;
+ // Now notify the broker that a new XA'ish transaction has started.
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.session.Connection.ConnectionId;
+ info.TransactionId = this.transactionId;
+ info.Type = (int) TransactionType.End;
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
- info.Type = (int) TransactionType.Rollback;
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
+ info.Type = (int) TransactionType.Rollback;
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
- Tracer.Debug("Transaction Rollback Reports Done: ");
+ Tracer.Debug("Transaction Rollback Reports Done: ");
- RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
+ RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
- // if server responds that nothing needs to be done, then reply done.
- enlistment.Done();
+ // if server responds that nothing needs to be done, then reply done.
+ enlistment.Done();
- AfterRollback();
+ AfterRollback();
+ }
}
catch(Exception ex)
{
Tracer.Debug("Transaction Rollback failed with error: " + ex.Message);
AfterRollback();
- this.session.Connection.OnException(ex);
+ try
+ {
+ this.connection.OnException(ex);
+ }
+ catch (Exception error)
+ {
+ Tracer.Error(error.ToString());
+ }
}
finally
{