17 |
|
import java.util.concurrent.locks.AbstractQueuedSynchronizer; |
18 |
|
import java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject; |
19 |
|
|
20 |
– |
import junit.framework.AssertionFailedError; |
20 |
|
import junit.framework.Test; |
21 |
|
import junit.framework.TestSuite; |
22 |
|
|
144 |
|
long startTime = System.nanoTime(); |
145 |
|
while (!sync.isQueued(t)) { |
146 |
|
if (millisElapsedSince(startTime) > LONG_DELAY_MS) |
147 |
< |
throw new AssertionFailedError("timed out"); |
147 |
> |
throw new AssertionError("timed out"); |
148 |
|
Thread.yield(); |
149 |
|
} |
150 |
|
assertTrue(t.isAlive()); |
1261 |
|
} |
1262 |
|
|
1263 |
|
/** |
1265 |
– |
* Disabled demo test for (unfixed as of 2017-11) |
1264 |
|
* JDK-8191483: AbstractQueuedSynchronizer cancel/cancel race |
1265 |
|
* ant -Djsr166.tckTestClass=AbstractQueuedSynchronizerTest -Djsr166.methodFilter=testCancelCancelRace -Djsr166.runsPerTest=100 tck |
1266 |
|
*/ |
1267 |
< |
public void XXXXtestCancelCancelRace() throws InterruptedException { |
1267 |
> |
public void testCancelCancelRace() throws InterruptedException { |
1268 |
|
class Sync extends AbstractQueuedSynchronizer { |
1269 |
|
protected boolean tryAcquire(int acquires) { |
1270 |
|
return !hasQueuedPredecessors() && compareAndSetState(0, 1); |