Committed() публичный Метод

public Committed ( ) : void
Результат void
 public void SinglePhaseCommit(SinglePhaseEnlistment en)
 {
     if (en == null)
     {
         throw new ArgumentNullException("en");
     }
     try
     {
         this.handle.WaitOne();
     }
     catch (ObjectDisposedException)
     {
     }
     lock (this.syncRoot)
     {
         try
         {
             this.transaction.Commit();
             en.Committed();
         }
         catch (Exception exception)
         {
             en.Aborted(exception);
         }
         finally
         {
             if ((this.connection != null) && (this.connection.State != ConnectionState.Closed))
             {
                 this.connection.Close();
                 this.connection = null;
             }
         }
     }
 }
		/// <summary>
		/// Notifies an enlisted object that the transaction is being committed.
		/// </summary>
		/// <param name="singlePhaseEnlistment">A <see cref="T:System.Transactions.SinglePhaseEnlistment"/> interface used to send a response to the transaction manager.</param>
		public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			onTxComplete();

			session.Commit(GetLocalOrDistributedTransactionId(transaction));
			singlePhaseEnlistment.Committed();
		}
		void IPromotableSinglePhaseNotification.SinglePhaseCommit( SinglePhaseEnlistment singlePhaseEnlistment ) {
			this.simpleTransaction.Commit();
			singlePhaseEnlistment.Committed();
			DriverTransactionManager.RemoveDriverInTransaction( this.baseTransaction );
			this.connection.driver.CurrentTransaction = null;
			if( this.connection.State == ConnectionState.Closed ) {
				this.connection.CloseFully();
			}
		}
Пример #4
0
    public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
    {
      simpleTransaction.Commit();
      singlePhaseEnlistment.Committed();
      DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);

      if (connection.State == ConnectionState.Closed)
        connection.CloseFully();
    }
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     try
     {
         Neo4jTransaction.DoCommit(_transactionExecutionEnvironment);
         singlePhaseEnlistment.Committed();
     }
     finally
     {
         singlePhaseEnlistment.Aborted();
     }
 }
Пример #6
0
		public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			if (this.disposed)
			{
				return;
			}

			try
			{
				if (this.dataAccessObjectDataContext != null)
				{
					this.commandsContext = this.GetSqlTransactionalCommandsContext();

					this.dataAccessObjectDataContext.Commit(this.commandsContext, false);
					this.commandsContext.Commit();
				}

				singlePhaseEnlistment.Committed();
			}
			catch (Exception e)
			{
				ActionUtils.IgnoreExceptions(() => this.commandsContext.Rollback());

				singlePhaseEnlistment.Aborted(e);
			}
			finally
			{
				this.Dispose();
			}
		}
        /// <summary>
        /// Notifies an enlisted object that the transaction is being committed.
        /// </summary>
        /// <param name="singlePhaseEnlistment">A <see cref="SinglePhaseEnlistment"/>
        /// interface used to send a response to the transaction manager.
        /// </param>
        public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
        {
            m_dbTransaction.Commit();
            singlePhaseEnlistment.Committed();
            m_dbConnection.Enlistment = null;

            if (m_disposeConnection)
            {
                m_dbConnection.Dispose();
            }
        }
 public virtual void SinglePhaseCommit(SinglePhaseEnlistment enlistment)
 {
     enlistment.Committed();
     this.Completed();
 }
Пример #9
0
 ///<summary>
 /// Attempt to commit the internal transaction.
 ///</summary>
 void IPromotableSinglePhaseNotification.SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     try
     {
         // attempt to commit the enlistment
         this.dbTransaction.Commit();
         singlePhaseEnlistment.Committed();
     }
     catch (Exception e)
     {
         // something went wrong, make sure the transaction aborts
         singlePhaseEnlistment.Aborted(e);
         throw;
     }
     finally
     {
         // clean-up our resources
         Dispose();
     }
 }
Пример #10
0
		public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			if (this.disposed)
			{
				return;
			}

			try
			{
				this.dataAccessObjectDataContext?.Commit(this, false);
				
				foreach (var commandsContext in this.commandsContextsBySqlDatabaseContexts.Values)
				{
					commandsContext.Commit();
				}

				singlePhaseEnlistment.Committed();
			}
			catch (Exception e)
			{
				commandsContextsBySqlDatabaseContexts.Values.ForEach(c => ActionUtils.IgnoreExceptions(c.Rollback));

				singlePhaseEnlistment.Aborted(e);
			}
			finally
			{
				this.Dispose();
			}
		}
		/// <summary>
		/// 	Represents the resource manager's implementation of the callback for the single phase commit optimization.
		/// </summary>
		/// <param name = "singlePhaseEnlistment">A <see cref = "T:System.Transactions.SinglePhaseEnlistment" />  used to send a response to the transaction manager.</param>
		public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			Console.WriteLine("SinglePhaseCommit");
			singlePhaseEnlistment.Committed();
		}
 public void SinglePhaseCommit(SinglePhaseEnlistment enlistment)
 {
     SqlInternalConnection validConnection = this.GetValidConnection();
     SqlConnection connection = validConnection.Connection;
     Bid.Trace("<sc.SqlDelegatedTransaction.SinglePhaseCommit|RES|CPOOL> %d#, Connection %d#, committing transaction.\n", this.ObjectID, validConnection.ObjectID);
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         if (validConnection.IsConnectionDoomed)
         {
             lock (validConnection)
             {
                 this._active = false;
                 this._connection = null;
             }
             enlistment.Aborted(SQL.ConnectionDoomed());
         }
         else
         {
             Exception exception;
             lock (validConnection)
             {
                 try
                 {
                     this.ValidateActiveOnConnection(validConnection);
                     this._active = false;
                     this._connection = null;
                     validConnection.ExecuteTransaction(SqlInternalConnection.TransactionRequest.Commit, null, System.Data.IsolationLevel.Unspecified, this._internalTransaction, true);
                     exception = null;
                 }
                 catch (SqlException exception3)
                 {
                     exception = exception3;
                     ADP.TraceExceptionWithoutRethrow(exception3);
                     validConnection.DoomThisConnection();
                 }
                 catch (InvalidOperationException exception2)
                 {
                     exception = exception2;
                     ADP.TraceExceptionWithoutRethrow(exception2);
                     validConnection.DoomThisConnection();
                 }
             }
             if (exception != null)
             {
                 if (this._internalTransaction.IsCommitted)
                 {
                     enlistment.Committed();
                 }
                 else if (this._internalTransaction.IsAborted)
                 {
                     enlistment.Aborted(exception);
                 }
                 else
                 {
                     enlistment.InDoubt(exception);
                 }
             }
             validConnection.CleanupConnectionOnTransactionCompletion(this._atomicTransaction);
             if (exception == null)
             {
                 enlistment.Committed();
             }
         }
     }
     catch (OutOfMemoryException exception6)
     {
         connection.Abort(exception6);
         throw;
     }
     catch (StackOverflowException exception5)
     {
         connection.Abort(exception5);
         throw;
     }
     catch (ThreadAbortException exception4)
     {
         connection.Abort(exception4);
         throw;
     }
 }
		public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			if (_npgsqlTx != null)
			{
				_npgsqlTx.Commit();
				_npgsqlTx.Dispose();
				_npgsqlTx = null;
				singlePhaseEnlistment.Committed();
			}
			else if (_callbacks != null)
			{
				if (_rm != null)
				{
					_rm.CommitWork(_callbacks.GetName());
					singlePhaseEnlistment.Committed();
				}
				else
				{
					_callbacks.CommitTransaction();
					singlePhaseEnlistment.Committed();
				}
				_callbacks = null;
			}
			_inTransaction = false;
		}
            public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
            {
                this.Release();
                this.Dispose();

                singlePhaseEnlistment.Committed();
            }
		public virtual void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			if (_SinglePhaseCommitCalled) throw new ApplicationException("single phase commit called before");
			_SinglePhaseCommitCalled = true;
			singlePhaseEnlistment.Committed();
		}
Пример #16
0
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     sessionImpl.Commit(txId);
     singlePhaseEnlistment.Committed();
 }
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     emitAllRecordedChanges();
     singlePhaseEnlistment.Committed();
 }
 void ISinglePhaseNotification.SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     CommitHelper();
     singlePhaseEnlistment.Committed();
     this.waitForTransaction.Set();
 }
Пример #19
0
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     _callbacks.CommitTransaction();
     singlePhaseEnlistment.Committed();
     _callbacks.Dispose();
 }
Пример #20
0
        public void SinglePhaseCommit ( SinglePhaseEnlistment enlistment )
        {
            resource.NumSingle++;
            if ( resource.IgnoreSPC )
                return;

            if ( resource.FailSPC ) {
                if ( resource.FailWithException )
                    enlistment.Aborted ( new NotSupportedException () );
                else
                    enlistment.Aborted ();
            }
            else {
                resource.Commit ();
                enlistment.Committed ();
            }
        }
Пример #21
0
        public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
        {
            try
            {
                DataAccessModelTransactionManager.currentlyCommitingTransaction = this.Transaction;

                this.dataAccessObjectDataContext?.Commit(this, false);

                foreach (var persistenceTransactionContext in this.persistenceTransactionContextsBySqlDatabaseContexts.Values)
                {
                    persistenceTransactionContext.sqlDatabaseCommandsContext.Commit();
                }

                singlePhaseEnlistment.Committed();
            }
            catch (Exception e)
            {
                foreach (var persistenceTransactionContext in this.persistenceTransactionContextsBySqlDatabaseContexts.Values)
                {
                    try
                    {
                        persistenceTransactionContext.sqlDatabaseCommandsContext.Rollback();
                    }
                    catch
                    {
                    }
                }

                singlePhaseEnlistment.Aborted(e);
            }
            finally
            {
                DataAccessModelTransactionManager.currentlyCommitingTransaction = null;

                this.Dispose();
            }
        }
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     log.Debug("SinglePhaseCommit {0}", TransactionId);
     if (_onprepare != null) _onprepare(this);
     if (_oncommit != null) _oncommit(this);
     singlePhaseEnlistment.Committed();
     TransactionOpen = false;
 }
Пример #23
0
 // This method will be called when the RM should Commit the
 // transaction.  Note that this method will be called even if
 // the transaction has actually been promoted to a distributed
 // transaction.
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     Log.Info("InternalRM.SinglePhaseCommit");
     db.CommitWork();
     singlePhaseEnlistment.Committed();
 }
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     _log.Debug("Single Phase Commit");
     if (_npgsqlTx != null)
     {
         _npgsqlTx.Commit();
         _npgsqlTx.Dispose();
         _npgsqlTx = null;
         singlePhaseEnlistment.Committed();
         _connection.PromotableLocalTransactionEnded();
     }
     else if (_callbacks != null)
     {
         if (_rm != null)
         {
             _rm.CommitWork(_callbacks.GetName());
             singlePhaseEnlistment.Committed();
         }
         else
         {
             _callbacks.CommitTransaction();
             singlePhaseEnlistment.Committed();
         }
         _callbacks = null;
     }
     _inTransaction = false;
 }
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "SinglePhaseCommit");
     if (_npgsqlTx != null)
     {
         _npgsqlTx.Commit();
         _npgsqlTx.Dispose();
         _npgsqlTx = null;
         singlePhaseEnlistment.Committed();
         _connection.PromotableLocalTransactionEnded();
     }
     else if (_callbacks != null)
     {
         if (_rm != null)
         {
             _rm.CommitWork(_callbacks.GetName());
             singlePhaseEnlistment.Committed();
         }
         else
         {
             _callbacks.CommitTransaction();
             singlePhaseEnlistment.Committed();
         }
         _callbacks = null;
     }
     _inTransaction = false;
 }
        public void SinglePhaseCommit(SinglePhaseEnlistment en)
        {
            if (en == null)
                throw new ArgumentNullException("en");

            //
            // Wait until IPendingWork members have completed (WinOE bugs 17580 and 13395)
            try
            {
                handle.WaitOne();
            }
            catch (ObjectDisposedException)
            {
                // If an ObjectDisposedException is thrown because
                // the WaitHandle has already closed, nothing to worry
                // about. Move on.
            }

            lock (syncRoot)
            {
                try
                {
                    this.transaction.Commit();
                    en.Committed();
                }
                catch (Exception e)
                {
                    en.Aborted(e);
                }
                finally
                {
                    if ((null != connection) && (ConnectionState.Closed != connection.State))
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
        }
        public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
        {
            // we receive a commit message
            // if we own a local transaction, then commit that transaction
            if (_transaction != null)
            {
                _transaction.Commit();
                _transaction = null;
                singlePhaseEnlistment.Committed();
            }
            else if (_transactionId > 0)
            {
                GetResourceManager().CommitTransaction(_transactionId);
                singlePhaseEnlistment.Committed();
            }

            _enlistedInTransactions.Remove(Transaction.Current);
        }
        // Called by the transaction to initiate commit sequence
        public void SinglePhaseCommit(SysTx.SinglePhaseEnlistment enlistment)
        {
            Debug.Assert(null != enlistment, "null enlistment?");

            SqlInternalConnection connection      = GetValidConnection();
            SqlConnection         usersConnection = connection.Connection;

            Bid.Trace("<sc.SqlDelegatedTransaction.SinglePhaseCommit|RES|CPOOL> %d#, Connection %d#, committing transaction.\n", ObjectID, connection.ObjectID);

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
#if DEBUG
                TdsParser.ReliabilitySection tdsReliabilitySection = new TdsParser.ReliabilitySection();

                RuntimeHelpers.PrepareConstrainedRegions();
                try {
                    tdsReliabilitySection.Start();
#else
                {
#endif //DEBUG
                    // If the connection is dooomed, we can be certain that the
                    // transaction will eventually be rolled back, and we shouldn't
                    // attempt to commit it.
                    if (connection.IsConnectionDoomed)
                    {
                        lock (connection)
                        {
                            _active     = false; // set to inactive first, doesn't matter how the rest completes, this transaction is done.
                            _connection = null;
                        }

                        enlistment.Aborted(SQL.ConnectionDoomed());
                    }
                    else
                    {
                        Exception commitException;
                        lock (connection)
                        {
                            try
                            {
                                // Now that we've acquired the lock, make sure we still have valid state for this operation.
                                ValidateActiveOnConnection(connection);

                                _active     = false; // set to inactive first, doesn't matter how the rest completes, this transaction is done.
                                _connection = null;  // Set prior to ExecuteTransaction call in case this initiates a TransactionEnd event

                                connection.ExecuteTransaction(SqlInternalConnection.TransactionRequest.Commit, null, IsolationLevel.Unspecified, _internalTransaction, true);
                                commitException = null;
                            }
                            catch (SqlException e)
                            {
                                commitException = e;

                                ADP.TraceExceptionWithoutRethrow(e);

                                // Doom the connection, to make sure that the transaction is
                                // eventually rolled back.
                                // VSTS 144562: doom the connection while having the lock on it to prevent race condition with "Transaction Ended" Event
                                connection.DoomThisConnection();
                            }
                            catch (InvalidOperationException e)
                            {
                                commitException = e;
                                ADP.TraceExceptionWithoutRethrow(e);
                                connection.DoomThisConnection();
                            }
                        }
                        if (commitException != null)
                        {
                            // connection.ExecuteTransaction failed with exception
                            if (_internalTransaction.IsCommitted)
                            {
                                // Even though we got an exception, the transaction
                                // was committed by the server.
                                enlistment.Committed();
                            }
                            else if (_internalTransaction.IsAborted)
                            {
                                // The transaction was aborted, report that to
                                // SysTx.
                                enlistment.Aborted(commitException);
                            }
                            else
                            {
                                // The transaction is still active, we cannot
                                // know the state of the transaction.
                                enlistment.InDoubt(commitException);
                            }

                            // We eat the exception.  This is called on the SysTx
                            // thread, not the applications thread.  If we don't
                            // eat the exception an UnhandledException will occur,
                            // causing the process to FailFast.
                        }

                        connection.CleanupConnectionOnTransactionCompletion(_atomicTransaction);
                        if (commitException == null)
                        {
                            // connection.ExecuteTransaction succeeded
                            enlistment.Committed();
                        }
                    }
                }
#if DEBUG
                finally {
                    tdsReliabilitySection.Stop();
                }
#endif //DEBUG
            }
            catch (System.OutOfMemoryException e)
            {
                usersConnection.Abort(e);
                throw;
            }
            catch (System.StackOverflowException e)
            {
                usersConnection.Abort(e);
                throw;
            }
            catch (System.Threading.ThreadAbortException e)
            {
                usersConnection.Abort(e);
                throw;
            }
        }
Пример #29
0
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     Log.Info("InternalServerRM.SPC");
     singlePhaseEnlistment.Committed();
 }
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     singlePhaseEnlistment.Committed();
 }
Пример #31
0
 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     try
     {
         WriteResources();
         singlePhaseEnlistment.Committed();
     }
     catch
     {
         singlePhaseEnlistment.Aborted();
         throw;
     }
 }