本文整理汇总了C#中System.Transactions.SinglePhaseEnlistment.Aborted方法的典型用法代码示例。如果您正苦于以下问题:C# SinglePhaseEnlistment.Aborted方法的具体用法?C# SinglePhaseEnlistment.Aborted怎么用?C# SinglePhaseEnlistment.Aborted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Transactions.SinglePhaseEnlistment
的用法示例。
在下文中一共展示了SinglePhaseEnlistment.Aborted方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rollback
public void Rollback(SinglePhaseEnlistment en)
{
if (en == null)
{
throw new ArgumentNullException("en");
}
try
{
this.handle.WaitOne();
}
catch (ObjectDisposedException)
{
}
lock (this.syncRoot)
{
if (this.transaction != null)
{
this.transaction.Dispose();
}
if ((this.connection != null) && (this.connection.State != ConnectionState.Closed))
{
this.connection.Close();
this.connection = null;
}
en.Aborted();
}
}
示例2:
void IPromotableSinglePhaseNotification.Rollback( SinglePhaseEnlistment singlePhaseEnlistment ) {
this.simpleTransaction.Rollback();
singlePhaseEnlistment.Aborted();
DriverTransactionManager.RemoveDriverInTransaction( this.baseTransaction );
this.connection.driver.CurrentTransaction = null;
if( this.connection.State == ConnectionState.Closed ) {
this.connection.CloseFully();
}
}
示例3: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
{
try
{
Neo4jTransaction.DoCommit(_transactionExecutionEnvironment);
singlePhaseEnlistment.Committed();
}
finally
{
singlePhaseEnlistment.Aborted();
}
}
示例4: Rollback
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
// prevent commands in main thread to run concurrently
Driver driver = connection.driver;
lock (driver)
{
rollbackThreadId = Thread.CurrentThread.ManagedThreadId;
while (connection.Reader != null)
{
// wait for reader to finish. Maybe we should not wait
// forever and cancel it after some time?
System.Threading.Thread.Sleep(100);
}
simpleTransaction.Rollback();
singlePhaseEnlistment.Aborted();
DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);
if (connection.State == ConnectionState.Closed)
connection.CloseFully();
rollbackThreadId = 0;
}
}
示例5: catch
///<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();
}
}
示例6:
/// <summary>
/// Notifies this object that the transaction is being rolled back.
/// </summary>
/// <param name="singlePhaseEnlistment">
/// Interfacet used to send a response to the transaction manager.
/// </param>
void IPromotableSinglePhaseNotification.Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
m_dbTransaction.Rollback();
singlePhaseEnlistment.Aborted();
m_dbConnection.Enlistment = null;
if (m_disposeConnection)
{
m_dbConnection.Dispose();
}
}
示例7: Rollback
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
session.Rollback(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction));
singlePhaseEnlistment.Aborted();
}
示例8: SinglePhaseCommit
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();
}
}
示例9: Rollback
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
// we receive a commit message
// if we own a local transaction, then commit that transaction
if (_transaction != null)
{
_transaction.Rollback();
_transaction = null;
}
else if (_transactionId > 0)
{
GetResourceManager().RollbackTransaction(_transactionId);
}
singlePhaseEnlistment.Aborted();
_enlistedInTransactions.Remove(Transaction.Current);
}
示例10: SinglePhaseCommit
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();
}
}
示例11: SinglePhaseCommit
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;
}
}
}
}
示例12: Rollback
/// <summary>
/// Rollbacks the specified single phase enlistment.
/// </summary>
/// <param name="singlePhaseEnlistment">The single phase enlistment.</param>
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
onTxComplete();
try
{
session.Rollback(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction));
DeleteFile();
}
catch (Exception e)
{
logger.ErrorException("Could not rollback distributed transaction", e);
singlePhaseEnlistment.InDoubt(e);
return;
}
singlePhaseEnlistment.Aborted();
}
示例13: Rollback
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Rollback");
// try to rollback the transaction with either the
// ADO.NET transaction or the callbacks that managed the
// two phase commit transaction.
if (_npgsqlTx != null)
{
_npgsqlTx.Rollback();
_npgsqlTx.Dispose();
_npgsqlTx = null;
singlePhaseEnlistment.Aborted();
_connection.PromotableLocalTransactionEnded();
}
else if (_callbacks != null)
{
if (_rm != null)
{
_rm.RollbackWork(_callbacks.GetName());
singlePhaseEnlistment.Aborted();
}
else
{
_callbacks.RollbackTransaction();
singlePhaseEnlistment.Aborted();
}
_callbacks = null;
}
_inTransaction = false;
}
示例14: SinglePhaseCommit
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 ();
}
}
示例15: Rollback
// This method will be called if the RM should Rollback the
// transaction. Note that this method will be called even if
// the transaction has been promoted to a distributed transaction.
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
Log.Info("InternalRM.Rollback");
db.RollbackWork();
singlePhaseEnlistment.Aborted();
}