Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long lookup(long txId) throws java.io.IOException
        public virtual long Lookup(long txId)
        {
            // First off see if the requested txId is in fact the last committed transaction.
            // If so then we can extract the checksum directly from the transaction id store.
            TransactionId lastCommittedTransaction = _transactionIdStore.LastCommittedTransaction;

            if (lastCommittedTransaction.TransactionIdConflict() == txId)
            {
                return(lastCommittedTransaction.Checksum());
            }

            // Check if the requested txId is upgrade transaction
            // if so then use checksum form transaction id store.
            // That checksum can take specific values that should not be re-evaluated.
            if (_upgradeTransaction.transactionId() == txId)
            {
                return(_upgradeTransaction.checksum());
            }

            // It wasn't, so go look for it in the transaction store.
            // Intentionally let potentially thrown IOException (and NoSuchTransactionException) be thrown
            // from this call below, it's part of the contract of this method.
            try
            {
                return(_logicalTransactionStore.getMetadataFor(txId).Checksum);
            }
            catch (NoSuchTransactionException e)
            {
                // So we truly couldn't find the checksum for this txId, go ahead and throw
                throw withMessage(e, e.Message + " | transaction id store says last transaction is " + lastCommittedTransaction + " and last upgrade transaction is " + _upgradeTransaction);
            }
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SetUp()
        {
            when(_transactionIdStore.LastCommittedTransaction).thenReturn(new TransactionId(1, 1, 1));
            when(_transactionIdStore.UpgradeTransaction).thenReturn(new TransactionId(2, 2, 2));
            when(_transactionStore.getMetadataFor(3)).thenReturn(new TransactionMetadataCache.TransactionMetadata(1, 1, mock(typeof(LogPosition)), 3, 3));
        }