Methods Summary |
---|
protected void | setUp()
if (INITIALIZEFAILED != null) {
throw INITIALIZEFAILED;
}
|
public void | test_parkFor_1()Test the case where the park times out.
Parker parker = new Parker(false, 500);
Thread parkerThread = new Thread(parker);
Thread waiterThread =
new Thread(new WaitAndUnpark(1000, parkerThread));
parkerThread.start();
waiterThread.start();
parker.assertDurationIsInRange(500);
|
public void | test_parkFor_2()Test the case where the unpark happens before the timeout.
Parker parker = new Parker(false, 1000);
Thread parkerThread = new Thread(parker);
Thread waiterThread =
new Thread(new WaitAndUnpark(300, parkerThread));
parkerThread.start();
waiterThread.start();
parker.assertDurationIsInRange(300);
|
public void | test_parkFor_3()Test the case where the thread is preemptively unparked.
Parker parker = new Parker(false, 1000);
Thread parkerThread = new Thread(parker);
UNSAFE.unpark(parkerThread);
parkerThread.start();
parker.assertDurationIsInRange(0);
|
public void | test_parkUntil_1()Test the case where the park times out.
Parker parker = new Parker(true, 500);
Thread parkerThread = new Thread(parker);
Thread waiterThread =
new Thread(new WaitAndUnpark(1000, parkerThread));
parkerThread.start();
waiterThread.start();
parker.assertDurationIsInRange(500);
|
public void | test_parkUntil_2()Test the case where the unpark happens before the timeout.
Parker parker = new Parker(true, 1000);
Thread parkerThread = new Thread(parker);
Thread waiterThread =
new Thread(new WaitAndUnpark(300, parkerThread));
parkerThread.start();
waiterThread.start();
parker.assertDurationIsInRange(300);
|
public void | test_parkUntil_3()Test the case where the thread is preemptively unparked.
Parker parker = new Parker(true, 1000);
Thread parkerThread = new Thread(parker);
UNSAFE.unpark(parkerThread);
parkerThread.start();
parker.assertDurationIsInRange(0);
|