コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void unblockNewTransactionsFromWrongThreadThrows() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void UnblockNewTransactionsFromWrongThreadThrows()
        {
            KernelTransactions kernelTransactions = NewKernelTransactions();

            kernelTransactions.BlockNewTransactions();

            Future <KernelTransaction> txOpener = T2.execute(state => kernelTransactions.NewInstance(@explicit, AnonymousContext.write(), 0L));

            T2.get().waitUntilWaiting(location => location.isAt(typeof(KernelTransactions), "newInstance"));

            AssertNotDone(txOpener);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.concurrent.Future<?> wrongUnblocker = unblockTxsInSeparateThread(kernelTransactions);
            Future <object> wrongUnblocker = UnblockTxsInSeparateThread(kernelTransactions);

            try
            {
                wrongUnblocker.get();
            }
            catch (Exception e)
            {
                assertThat(e, instanceOf(typeof(ExecutionException)));
                assertThat(e.InnerException, instanceOf(typeof(System.InvalidOperationException)));
            }
            AssertNotDone(txOpener);

            kernelTransactions.UnblockNewTransactions();
            assertNotNull(txOpener.get());
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void blockNewTransactions() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void BlockNewTransactions()
        {
            KernelTransactions kernelTransactions = NewKernelTransactions();

            kernelTransactions.BlockNewTransactions();

            Future <KernelTransaction> txOpener = T2.execute(state => kernelTransactions.NewInstance(@explicit, AnonymousContext.write(), 0L));

            T2.get().waitUntilWaiting(location => location.isAt(typeof(KernelTransactions), "newInstance"));

            AssertNotDone(txOpener);

            kernelTransactions.UnblockNewTransactions();
            assertNotNull(txOpener.get());
        }