//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void exclusiveLockCanBeStopped() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ExclusiveLockCanBeStopped() { AcquireExclusiveLockInThisThread(); LockAcquisition exclusiveLockAcquisition = AcquireExclusiveLockInAnotherThread(); AssertThreadIsWaitingForLock(exclusiveLockAcquisition); exclusiveLockAcquisition.Stop(); AssertLockAcquisitionFailed(exclusiveLockAcquisition); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void acquireExclusiveLockAfterSharedLockStoppedOtherThread() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AcquireExclusiveLockAfterSharedLockStoppedOtherThread() { AcquiredLock thisThreadsExclusiveLock = AcquireExclusiveLockInThisThread(); LockAcquisition sharedLockAcquisition = AcquireSharedLockInAnotherThread(); AssertThreadIsWaitingForLock(sharedLockAcquisition); sharedLockAcquisition.Stop(); AssertLockAcquisitionFailed(sharedLockAcquisition); thisThreadsExclusiveLock.Release(); LockAcquisition exclusiveLockAcquisition = AcquireExclusiveLockInAnotherThread(); AssertLockAcquisitionSucceeded(exclusiveLockAcquisition); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void acquireLockAfterOtherLockStoppedSameThread(boolean firstLockShared, boolean secondLockShared) throws Exception private void AcquireLockAfterOtherLockStoppedSameThread(bool firstLockShared, bool secondLockShared) { AcquiredLock thisThreadsExclusiveLock = AcquireExclusiveLockInThisThread(); System.Threading.CountdownEvent firstLockFailed = new System.Threading.CountdownEvent(1); System.Threading.CountdownEvent startSecondLock = new System.Threading.CountdownEvent(1); LockAcquisition lockAcquisition = AcquireTwoLocksInAnotherThread(firstLockShared, secondLockShared, firstLockFailed, startSecondLock); AssertThreadIsWaitingForLock(lockAcquisition); lockAcquisition.Stop(); Await(firstLockFailed); thisThreadsExclusiveLock.Release(); startSecondLock.Signal(); AssertLockAcquisitionSucceeded(lockAcquisition); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void closeClientAfterLockStopped(boolean shared) throws Exception private void CloseClientAfterLockStopped(bool shared) { AcquiredLock thisThreadsExclusiveLock = AcquireExclusiveLockInThisThread(); System.Threading.CountdownEvent firstLockAcquired = new System.Threading.CountdownEvent(1); LockAcquisition acquisition = TryAcquireTwoLocksLockInAnotherThread(shared, firstLockAcquired); Await(firstLockAcquired); AssertThreadIsWaitingForLock(acquisition); AssertLocksHeld(FIRST_NODE_ID, SECOND_NODE_ID); acquisition.Stop(); AssertLockAcquisitionFailed(acquisition); AssertLocksHeld(FIRST_NODE_ID); thisThreadsExclusiveLock.Release(); AssertNoLocksHeld(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void acquireExclusiveLockWhileHoldingSharedLockCanBeStopped() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AcquireExclusiveLockWhileHoldingSharedLockCanBeStopped() { AcquiredLock thisThreadsSharedLock = AcquireSharedLockInThisThread(); System.Threading.CountdownEvent sharedLockAcquired = new System.Threading.CountdownEvent(1); System.Threading.CountdownEvent startExclusiveLock = new System.Threading.CountdownEvent(1); LockAcquisition acquisition = AcquireSharedAndExclusiveLocksInAnotherThread(sharedLockAcquired, startExclusiveLock); Await(sharedLockAcquired); startExclusiveLock.Signal(); AssertThreadIsWaitingForLock(acquisition); acquisition.Stop(); AssertLockAcquisitionFailed(acquisition); thisThreadsSharedLock.Release(); AssertNoLocksHeld(); }