Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustReleaseWriteLockWaitersOnStop()
        public virtual void MustReleaseWriteLockWaitersOnStop()
        {
            // Given
            ClientA.acquireShared(_tracer, NODE, 1L);
            ClientB.acquireShared(_tracer, NODE, 2L);
            ClientC.acquireShared(_tracer, NODE, 3L);
            AcquireExclusive(ClientB, _tracer, NODE, 1L).callAndAssertWaiting();
            AcquireExclusive(ClientC, _tracer, NODE, 1L).callAndAssertWaiting();

            // When
            ClientC.stop();
            ClientB.stop();
            ClientA.stop();

            // All locks clients should be stopped at this point, and all all locks should be released because none of the
            // clients entered the prepare phase
            LockCountVisitor lockCountVisitor = new LockCountVisitor();

            Locks.accept(lockCountVisitor);
            assertEquals(0, lockCountVisitor.LockCount);
        }