public class StampedLockTest extends JSR166TestCase
JSR166TestCase.AdjustablePolicy, JSR166TestCase.CallableOne, JSR166TestCase.CheckedBarrier, JSR166TestCase.CheckedCallable<T>, JSR166TestCase.CheckedInterruptedCallable<T>, JSR166TestCase.CheckedInterruptedRunnable, JSR166TestCase.CheckedRecursiveAction, JSR166TestCase.CheckedRecursiveTask<T>, JSR166TestCase.CheckedRunnable, JSR166TestCase.LongPossiblyInterruptedRunnable, JSR166TestCase.MediumInterruptedRunnable, JSR166TestCase.MediumPossiblyInterruptedRunnable, JSR166TestCase.MediumRunnable, JSR166TestCase.NoOpCallable, JSR166TestCase.NoOpREHandler, JSR166TestCase.NoOpRunnable, JSR166TestCase.NPETask, JSR166TestCase.RunnableShouldThrow, JSR166TestCase.ShortInterruptedRunnable, JSR166TestCase.ShortRunnable, JSR166TestCase.SimpleThreadFactory, JSR166TestCase.SmallCallable, JSR166TestCase.SmallPossiblyInterruptedRunnable, JSR166TestCase.SmallRunnable, JSR166TestCase.StringTask, JSR166TestCase.ThreadShouldThrow, JSR166TestCase.TrackedCallable, JSR166TestCase.TrackedLongRunnable, JSR166TestCase.TrackedMediumRunnable, JSR166TestCase.TrackedNoOpRunnable, JSR166TestCase.TrackedRunnable, JSR166TestCase.TrackedShortRunnable, JSR166TestCase.TrackedSmallRunnable
eight, expensiveTests, five, four, JAVA_CLASS_VERSION, JAVA_SPECIFICATION_VERSION, LONG_DELAY_MS, m1, m10, m2, m3, m4, m5, m6, MEDIUM_DELAY_MS, nine, one, seven, SHORT_DELAY_MS, six, SIZE, SMALL_DELAY_MS, TEST_STRING, testImplementationDetails, three, two, zero
Constructor and Description |
---|
StampedLockTest() |
Modifier and Type | Method and Description |
---|---|
void |
testAsReadLock()
asReadLock can be locked and unlocked
|
void |
testAsReadWriteLockReadLock()
asReadWriteLock.readLock can be locked and unlocked
|
void |
testAsReadWriteLockWriteLock()
asReadWriteLock.writeLock can be locked and unlocked
|
void |
testAsWriteLock()
asWriteLock can be locked and unlocked
|
void |
testConstructor()
Constructed StampedLock is in unlocked state
|
void |
testLock()
write-locking and read-locking an unlocked lock succeed
|
void |
testMultipleReadLocks()
Multiple threads can hold a read lock when not write-locked
|
void |
testReadAfterWriteLock()
Readlocks succeed only after a writing thread unlocks
|
void |
testReadLockInterruptibly_Interruptible()
readLockInterruptibly is interruptible
|
void |
testReadLockInterruptibly()
readLockInterruptibly succeeds if lock free else is interruptible
|
void |
testReadTryLock_Interruptible()
timed tryReadLock is interruptible
|
void |
testReadTryLock_Timeout()
timed tryReadLock times out if write-locked
|
void |
testReadTryLockWhenLocked()
tryReadLock fails if write-locked
|
void |
testReadUnlock_IMSE()
read-unlocking an unlocked lock throws IllegalMonitorStateException
|
void |
testReadUnlock_IMSE2()
read-unlocking an unlocked lock throws IllegalMonitorStateException
|
void |
testReadUnlock_IMSE3()
read-unlocking after writeLock throws IllegalMonitorStateException
|
void |
testSerialization()
A serialized lock deserializes as unlocked
|
void |
testToString()
toString indicates current lock state
|
void |
testTryConvertToOptimisticRead()
tryConvertToOptimisticRead succeeds and validates if successfully locked,
|
void |
testTryConvertToReadLock()
tryConvertToReadLock succeeds and validates if successfully locked
or lock free;
|
void |
testTryConvertToWriteLock()
tryConvertToWriteLock succeeds and validates if successfully locked
or lock free;
|
void |
testTryLockWhenReadLocked()
tryReadLock succeeds if readlocked but not writelocked
|
void |
testTryUnlock()
tryUnlockRead/Write succeeds if locked in associated mode else
returns false
|
void |
testUnlock()
unlock releases either a read or write lock
|
void |
testValidate()
A stamp obtained from a successful lock operation validates
|
void |
testValidate0()
validate(0) fails
|
void |
testValidate2()
A stamp obtained from an unsuccessful lock operation does not validate
|
void |
testValidateOptimistic()
tryOptimisticRead succeeds and validates if unlocked, fails if locked
|
void |
testValidateOptimisticWriteLocked()
tryOptimisticRead stamp does not validate if a write lock intervenes
|
void |
testValidateOptimisticWriteLocked2()
tryOptimisticRead stamp does not validate if a write lock
intervenes in another thread
|
void |
testWriteAfterMultipleReadLocks()
A writelock succeeds only after reading threads unlock
|
void |
testWriteAfterReadLock()
A writelock succeeds only after a reading thread unlocks
|
void |
testWriteLockInterruptibly_Interruptible()
writeLockInterruptibly is interruptible
|
void |
testWriteLockInterruptibly()
writeLockInterruptibly succeeds if unlocked, else is interruptible
|
void |
testWriteTryLock_Interruptible()
timed tryWriteLock is interruptible
|
void |
testWriteTryLock_Timeout()
timed tryWriteLock times out if locked
|
void |
testWriteTryLock()
tryWriteLock on an unlocked lock succeeds
|
void |
testWriteTryLockWhenLocked()
tryWriteLock fails if locked
|
void |
testWriteTryLockWhenReadLocked()
tryWriteLock fails when readlocked
|
void |
testWriteUnlock_IMSE()
write-unlocking an unlocked lock throws IllegalMonitorStateException
|
void |
testWriteUnlock_IMSE2()
write-unlocking an unlocked lock throws IllegalMonitorStateException
|
void |
testWriteUnlock_IMSE3()
write-unlocking after readlock throws IllegalMonitorStateException
|
addNamedTestClasses, assertIteratorExhausted, assertThrows, atLeastJava10, atLeastJava6, atLeastJava7, atLeastJava8, atLeastJava9, await, await, await, awaiter, countDowner, getShortDelay, jdk8ParameterizedTestSuite, latchAwaitingStringTask, newTestSuite, parameterizedTestSuite, permissivePolicy, possiblyInterruptedRunnable, runBare, runTest, runTestProfiled, runWithoutPermissions, runWithPermissions, runWithSecurityManagerWithPermissions, setDelays, setUp, shouldThrow, shouldThrow, tearDown, testMethodNames, threadAssertEquals, threadAssertEquals, threadAssertFalse, threadAssertNull, threadAssertSame, threadAssertTrue, threadFail, threadRecordFailure, threadShouldThrow, threadShouldThrow, threadUnexpectedException, trackedRunnable
public void testConstructor()
public void testLock()
public void testUnlock()
public void testTryUnlock()
public void testWriteUnlock_IMSE()
public void testWriteUnlock_IMSE2()
public void testWriteUnlock_IMSE3()
public void testReadUnlock_IMSE()
public void testReadUnlock_IMSE2()
public void testReadUnlock_IMSE3()
public void testValidate0()
public void testValidate() throws InterruptedException
InterruptedException
public void testValidate2() throws InterruptedException
InterruptedException
public void testWriteLockInterruptibly_Interruptible() throws InterruptedException
InterruptedException
public void testWriteTryLock_Interruptible() throws InterruptedException
InterruptedException
public void testReadLockInterruptibly_Interruptible() throws InterruptedException
InterruptedException
public void testReadTryLock_Interruptible() throws InterruptedException
InterruptedException
public void testWriteTryLock()
public void testWriteTryLockWhenLocked()
public void testReadTryLockWhenLocked()
public void testMultipleReadLocks()
public void testWriteAfterReadLock() throws InterruptedException
InterruptedException
public void testWriteAfterMultipleReadLocks()
public void testReadAfterWriteLock()
public void testTryLockWhenReadLocked()
public void testWriteTryLockWhenReadLocked()
public void testWriteTryLock_Timeout()
public void testReadTryLock_Timeout()
public void testWriteLockInterruptibly() throws InterruptedException
InterruptedException
public void testReadLockInterruptibly() throws InterruptedException
InterruptedException
public void testSerialization()
public void testToString()
public void testValidateOptimistic() throws InterruptedException
InterruptedException
public void testValidateOptimisticWriteLocked()
public void testValidateOptimisticWriteLocked2() throws InterruptedException
InterruptedException
public void testTryConvertToOptimisticRead() throws InterruptedException
InterruptedException
public void testTryConvertToReadLock() throws InterruptedException
InterruptedException
public void testTryConvertToWriteLock() throws InterruptedException
InterruptedException
public void testAsWriteLock()
public void testAsReadLock()
public void testAsReadWriteLockWriteLock()
public void testAsReadWriteLockReadLock()