Example #1
0
        internal TransactionBase(long identifier, ITransactionalReplicator replicator, bool isPrimaryTransaction)
        {
            this.stateMachine            = new TransactionStateMachine(identifier);
            this.id                      = identifier;
            this.LockContexts            = new List <LockContext>();
            this.readLockContexts        = new List <LockContext>();
            this.isPrimaryTx             = isPrimaryTransaction;
            this.transactionalReplicator = replicator;
            this.TransactionRetryDelay   = RetryDelay;

            this.commitSequenceNumber = LogicalSequenceNumber.InvalidLsn.LSN;
        }
Example #2
0
        internal void ThrowIfTransactionIsNotActive()
        {
            var state = State;

            if (state == TransactionState.Active)
            {
                // This is fine
            }
            else if (state == TransactionState.Reading)
            {
                // message must indicate 2 reads or write during read is not possible
                throw new InvalidOperationException(TransactionStateMachine.GetTransactionIdFormattedString(SR.Error_ReplicatorTransactionReadInProgress, id));
            }
            else
            {
                throw new InvalidOperationException(TransactionStateMachine.GetTransactionIdFormattedString(SR.Error_ReplicatorTransactionNotActive, id));
            }
        }