private void EnsureEnslistment() { AssertNotDisposedOrDisposing(); if (Transaction.Current == null) throw new InvalidOperationException("You must use TransactionScope when using Rhino.Queues"); if (CurrentlyEnslistedTransaction == Transaction.Current) return; // need to change the enslitment #pragma warning disable 420 Interlocked.Increment(ref currentlyInsideTransaction); #pragma warning restore 420 Enlistment = new TransactionEnlistment(queueStorage, () => { lock (newMessageArrivedLock) { Monitor.PulseAll(newMessageArrivedLock); } #pragma warning disable 420 Interlocked.Decrement(ref currentlyInsideTransaction); #pragma warning restore 420 }, AssertNotDisposed); CurrentlyEnslistedTransaction = Transaction.Current; }
private void EnsureEnlistment() { AssertNotDisposedOrDisposing(); if (Transaction.Current == null) throw new InvalidOperationException("You must use TransactionScope when using Rhino.Queues"); if (CurrentlyEnslistedTransaction == Transaction.Current) return; // need to change the enlistment Interlocked.Increment(ref currentlyInsideTransaction); Enlistment = new TransactionEnlistment(queueStorage, OnTransactionComplete, AssertNotDisposed); CurrentlyEnslistedTransaction = Transaction.Current; }