public void Begin()
 {
     if (transactionId == null)
     {
         transactionId = session.Connection.CreateLocalTransactionId();
         
         TransactionInfo info = new TransactionInfo();
         info.ConnectionId = session.Connection.ConnectionId;
         info.TransactionId = transactionId;
         info.Type = (int) TransactionType.Begin;
         session.Connection.OneWay(info);
     }
 }
Пример #2
0
		public static string ToStomp(TransactionId id)
		{
			if (id is LocalTransactionId)
			{
				return ToStomp(id as LocalTransactionId);
			}
			return id.ToString();
		}
Пример #3
0
		public virtual bool Equals(TransactionId that) {
            return true;

		}
        public void Commit()
        {
            foreach (ISynchronization synchronization in synchronizations)
			{
                synchronization.BeforeCommit();
            }
            
            if (transactionId != null)
            {
                TransactionInfo info = new TransactionInfo();
                info.ConnectionId = session.Connection.ConnectionId;
                info.TransactionId = transactionId;
                info.Type = (int) TransactionType.CommitOnePhase;
                
                transactionId = null;
                session.Connection.OneWay(info);
            }
            
            foreach (ISynchronization synchronization in synchronizations)
			{
                synchronization.AfterCommit();
            }
            synchronizations.Clear();
        }
        public void Rollback()
        {
            if (transactionId != null)
            {
                TransactionInfo info = new TransactionInfo();
                info.ConnectionId = session.Connection.ConnectionId;
                info.TransactionId = transactionId;
                info.Type = (int) TransactionType.Rollback;
                
                transactionId = null;
                session.Connection.OneWay(info);
            }
            
            foreach (ISynchronization synchronization in synchronizations)
			{
                synchronization.AfterRollback();
            }
            synchronizations.Clear();
        }
 /// <summary>
 /// Converts the given transaction ID into a String
 /// </summary>
 public static String ToString(TransactionId txnId)
 {
     if (txnId is LocalTransactionId)
     {
         LocalTransactionId ltxnId = (LocalTransactionId) txnId;
         return "" + ltxnId.Value;
     }
     else if (txnId is XATransactionId)
     {
         XATransactionId xaTxnId = (XATransactionId) txnId;
         return "XID:" + xaTxnId.FormatId + ":" + ToHexFromBytes(xaTxnId.GlobalTransactionId) + ":" + ToHexFromBytes(xaTxnId.BranchQualifier);
     }
     return null;
 }
Пример #7
0
 public virtual bool Equals(TransactionId that)
 {
     return(true);
 }