1072 |
|
} |
1073 |
|
|
1074 |
|
/** |
1075 |
< |
* tryTransfer waits the amount given if interrupted, and |
1076 |
< |
* throws interrupted exception |
1075 |
> |
* tryTransfer waits the amount given, and throws |
1076 |
> |
* InterruptedException when interrupted. |
1077 |
|
*/ |
1078 |
|
public void testTryTransfer5() throws InterruptedException { |
1079 |
|
final LinkedTransferQueue q = new LinkedTransferQueue(); |
1080 |
|
final CountDownLatch threadStarted = new CountDownLatch(1); |
1081 |
+ |
assertTrue(q.isEmpty()); |
1082 |
|
|
1083 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
1084 |
|
public void realRun() throws InterruptedException { |
1089 |
|
shouldThrow(); |
1090 |
|
} catch (InterruptedException success) {} |
1091 |
|
assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); |
1092 |
+ |
assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS); |
1093 |
|
}}); |
1094 |
|
|
1095 |
|
threadStarted.await(); |
1096 |
+ |
while (q.isEmpty()) |
1097 |
+ |
Thread.yield(); |
1098 |
|
Thread.sleep(SHORT_DELAY_MS); |
1099 |
|
t.interrupt(); |
1100 |
|
awaitTermination(t, MEDIUM_DELAY_MS); |
1144 |
|
} |
1145 |
|
|
1146 |
|
/** |
1147 |
< |
* tryTransfer attempts to enqueue into the q and fails returning |
1148 |
< |
* false not enqueueing and the successive poll is null |
1147 |
> |
* tryTransfer attempts to enqueue into the queue and fails |
1148 |
> |
* returning false not enqueueing and the successive poll is null |
1149 |
|
*/ |
1150 |
|
public void testTryTransfer8() throws InterruptedException { |
1151 |
|
final LinkedTransferQueue q = new LinkedTransferQueue(); |