313 |
|
public void realRun() throws InterruptedException { |
314 |
|
Thread.currentThread().interrupt(); |
315 |
|
for (int i = 0; i < SIZE; ++i) { |
316 |
< |
long t0 = System.nanoTime(); |
316 |
> |
long startTime = System.nanoTime(); |
317 |
|
assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); |
318 |
< |
assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); |
318 |
> |
assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS); |
319 |
|
} |
320 |
|
try { |
321 |
|
q.poll(MEDIUM_DELAY_MS, MILLISECONDS); |
969 |
|
|
970 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
971 |
|
public void realRun() throws InterruptedException { |
972 |
< |
long t0 = System.nanoTime(); |
972 |
> |
long startTime = System.nanoTime(); |
973 |
|
assertFalse(q.tryTransfer(new Object(), |
974 |
|
timeoutMillis(), MILLISECONDS)); |
975 |
< |
assertTrue(millisElapsedSince(t0) >= timeoutMillis()); |
975 |
> |
assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); |
976 |
|
checkEmpty(q); |
977 |
|
}}); |
978 |
|
|
1011 |
|
final LinkedTransferQueue q = new LinkedTransferQueue(); |
1012 |
|
assertTrue(q.offer(four)); |
1013 |
|
assertEquals(1, q.size()); |
1014 |
< |
long t0 = System.nanoTime(); |
1014 |
> |
long startTime = System.nanoTime(); |
1015 |
|
assertFalse(q.tryTransfer(five, timeoutMillis(), MILLISECONDS)); |
1016 |
< |
assertTrue(millisElapsedSince(t0) >= timeoutMillis()); |
1016 |
> |
assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); |
1017 |
|
assertEquals(1, q.size()); |
1018 |
|
assertSame(four, q.poll()); |
1019 |
|
assertNull(q.poll()); |