public class PhaserTest 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 |
---|
PhaserTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertState(Phaser phaser,
int phase,
int parties,
int unarrived)
Checks state of unterminated phaser.
|
protected void |
assertTerminated(Phaser phaser,
int maxPhase) |
protected void |
assertTerminated(Phaser phaser,
int maxPhase,
int parties)
Checks state of terminated phaser.
|
void |
testArrive1()
arrive() on a registered phaser increments phase.
|
void |
testArrive2()
arriveAndDeregister does not wait for others to arrive at barrier
|
void |
testArrive3()
arrive() returns a negative number if the Phaser is terminated
|
void |
testArriveAndAwaitAdvance1()
arriveAndAwaitAdvance throws IllegalStateException with no
unarrived parties
|
void |
testArriveAndAwaitAdvance3()
arriveAndAwaitAdvance waits for all threads to arrive, the
number of arrived parties is the same number that is accounted
for when the main thread awaitsAdvance
|
void |
testArriveAndAwaitAdvanceAfterInterrupt()
arriveAndAwaitAdvance continues waiting if interrupted before waiting
|
void |
testArriveAndAwaitAdvanceBeforeInterrupt()
arriveAndAwaitAdvance continues waiting if interrupted while waiting
|
void |
testArriveAndDeregister()
arriveAndDeregister does not wait for others to arrive at barrier
|
void |
testArriveAndDeregister1()
arriveAndDeregister() throws IllegalStateException if number of
registered or unarrived parties would become negative
|
void |
testArriveAndDeregister2()
arriveAndDeregister reduces the number of arrived parties
|
void |
testArriveAndDeregister3()
arriveAndDeregister arrives at the barrier on a phaser with a parent and
when a deregistration occurs and causes the phaser to have zero parties
its parent will be deregistered as well
|
void |
testArriveAndDeregister4()
arriveAndDeregister deregisters one party from its parent when
the number of parties of child is zero after deregistration
|
void |
testArriveAndDeregister5()
arriveAndDeregister deregisters one party from its parent when
the number of parties of root is nonzero after deregistration.
|
void |
testArriveAndDeregister6()
arriveAndDeregister returns the phase in which it leaves the
phaser in after deregistration
|
void |
testAwaitAdvance1()
awaitAdvance succeeds upon advance
|
void |
testAwaitAdvance2()
awaitAdvance with a negative parameter will return without affecting the
phaser
|
void |
testAwaitAdvance4()
awaitAdvance atomically waits for all parties within the same phase to
complete before continuing
|
void |
testAwaitAdvance5()
awaitAdvance returns the current phase
|
void |
testAwaitAdvance6()
awaitAdvance returns when the phaser is externally terminated
|
void |
testAwaitAdvanceAfterInterrupt()
awaitAdvance continues waiting if interrupted before waiting
|
void |
testAwaitAdvanceBeforeInterrupt()
awaitAdvance continues waiting if interrupted while waiting
|
void |
testAwaitAdvanceInterruptibly_interruptible()
awaitAdvanceInterruptibly blocks interruptibly
|
void |
testAwaitAdvanceTieredPhaser()
awaitAdvance returns the current phase in child phasers
|
void |
testBulkRegister1()
Invoking bulkRegister with a negative parameter throws an
IllegalArgumentException
|
void |
testBulkRegister2()
bulkRegister should correctly record the number of unarrived
parties with the number of parties being registered
|
void |
testBulkRegister3()
Registering with a number of parties greater than or equal to 1<<16
throws IllegalStateException.
|
void |
testConstructor3()
The parent provided to the constructor should be returned from
a later call to getParent
|
void |
testConstructor5()
The parent being input into the parameter should equal the original
parent when being returned
|
void |
testConstructorDefaultValues()
Empty constructor builds a new Phaser with no parent, no registered
parties and initial phase number of 0
|
void |
testConstructorNegativeParties()
Constructing with a negative number of parties throws
IllegalArgumentException
|
void |
testConstructorNegativeParties2()
Constructing with a negative number of parties throws
IllegalArgumentException
|
void |
testConstructorPartiesExceedsLimit()
Constructing with a number of parties > 65535 throws
IllegalArgumentException
|
void |
testPhaseIncrement1()
the phase number increments correctly when tripping the barrier
|
void |
testRegister1()
register() will increment the number of unarrived parties by
one and not affect its arrived parties
|
void |
testRegister2()
Registering more than 65536 parties causes IllegalStateException
|
void |
testRegister3()
register() correctly returns the current barrier phase number
when invoked
|
void |
testRegister4()
register causes the next arrive to not increment the phase
rather retain the phase number
|
void |
testRegisterEmptySubPhaser()
register on a subphaser that is currently empty succeeds, even
in the presence of another non-empty subphaser
|
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
protected void assertState(Phaser phaser, int phase, int parties, int unarrived)
protected void assertTerminated(Phaser phaser, int maxPhase, int parties)
protected void assertTerminated(Phaser phaser, int maxPhase)
public void testConstructorDefaultValues()
public void testConstructorNegativeParties()
public void testConstructorNegativeParties2()
public void testConstructorPartiesExceedsLimit()
public void testConstructor3()
public void testConstructor5()
public void testRegister1()
public void testRegister2()
public void testRegister3()
public void testRegister4()
public void testRegisterEmptySubPhaser()
public void testBulkRegister1()
public void testBulkRegister2()
public void testBulkRegister3()
public void testPhaseIncrement1()
public void testArrive1()
public void testArriveAndDeregister()
public void testArrive2()
public void testArrive3()
public void testArriveAndDeregister1()
public void testArriveAndDeregister2()
public void testArriveAndDeregister3()
public void testArriveAndDeregister4()
public void testArriveAndDeregister5()
public void testArriveAndDeregister6()
public void testAwaitAdvance1()
public void testAwaitAdvance2()
public void testAwaitAdvanceInterruptibly_interruptible() throws InterruptedException
InterruptedException
public void testAwaitAdvanceAfterInterrupt()
public void testAwaitAdvanceBeforeInterrupt()
public void testArriveAndAwaitAdvanceAfterInterrupt()
public void testArriveAndAwaitAdvanceBeforeInterrupt()
public void testAwaitAdvance4()
public void testAwaitAdvance5()
public void testAwaitAdvanceTieredPhaser() throws Exception
Exception
public void testAwaitAdvance6()
public void testArriveAndAwaitAdvance1()
public void testArriveAndAwaitAdvance3()