//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT_MILLIS) public void testLockRequestsTermination() throws InterruptedException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestLockRequestsTermination() { // given RagManager ragManager = new RagManager(); LockResource node1 = new LockResource(ResourceTypes.NODE, 1L); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RWLock lock = createRWLock(ragManager, node1); RWLock @lock = CreateRWLock(ragManager, node1); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LockTransaction mainTransaction = new LockTransaction(); LockTransaction mainTransaction = new LockTransaction(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LockTransaction writerTransaction = new LockTransaction(); LockTransaction writerTransaction = new LockTransaction(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.CountDownLatch writerCompletedLatch = new java.util.concurrent.CountDownLatch(1); System.Threading.CountdownEvent writerCompletedLatch = new System.Threading.CountdownEvent(1); ThreadStart conflictingWriter = CreateFailedWriter(@lock, writerTransaction, writerCompletedLatch); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LockTransaction readerTransaction = new LockTransaction(); LockTransaction readerTransaction = new LockTransaction(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.CountDownLatch readerCompletedLatch = new java.util.concurrent.CountDownLatch(1); System.Threading.CountdownEvent readerCompletedLatch = new System.Threading.CountdownEvent(1); ThreadStart reader = CreateFailedReader(@lock, readerTransaction, readerCompletedLatch); // when @lock.Mark(); assertTrue(@lock.AcquireWriteLock(LockTracer.NONE, mainTransaction)); _executor.submit(reader); _executor.submit(conflictingWriter); // wait waiters to come WaitWaitingThreads(@lock, 2); assertEquals(3, @lock.TxLockElementCount); // when @lock.TerminateLockRequestsForLockTransaction(readerTransaction); @lock.TerminateLockRequestsForLockTransaction(writerTransaction); readerCompletedLatch.await(); writerCompletedLatch.await(); // expect only main write lock counters and elements present // all the rest should be cleaned up assertEquals(0, @lock.WaitingThreadsCount); assertEquals(0, @lock.ReadCount); assertEquals(1, @lock.WriteCount); assertEquals(1, @lock.TxLockElementCount); }