13 |
|
import java.io.ObjectOutputStream; |
14 |
|
import java.util.ArrayList; |
15 |
|
import java.util.Arrays; |
16 |
– |
import java.util.ConcurrentModificationException; |
16 |
|
import java.util.Iterator; |
17 |
|
import java.util.List; |
18 |
|
import java.util.NoSuchElementException; |
354 |
|
*/ |
355 |
|
public void testInterruptedTimedPoll() throws InterruptedException { |
356 |
|
final LinkedTransferQueue<Integer> q = populatedQueue(SIZE); |
357 |
< |
Thread t = newStartedThread(new CheckedInterruptedRunnable() { |
357 |
> |
Thread t = newStartedThread(new CheckedRunnable() { |
358 |
|
void realRun() throws InterruptedException { |
359 |
|
for (int i = 0; i < SIZE; ++i) { |
360 |
|
long t0 = System.nanoTime(); |
363 |
|
long millisElapsed = (System.nanoTime() - t0)/(1024 * 1024); |
364 |
|
assertTrue(millisElapsed < SMALL_DELAY_MS); |
365 |
|
} |
366 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
366 |
> |
try { |
367 |
> |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
368 |
> |
} catch (InterruptedException success) {} |
369 |
|
}}); |
370 |
|
Thread.sleep(SMALL_DELAY_MS); |
371 |
|
t.interrupt(); |
888 |
|
LinkedTransferQueue q = new LinkedTransferQueue(); |
889 |
|
q.transfer(null); |
890 |
|
shouldThrow(); |
891 |
< |
} catch (NullPointerException ex) { |
891 |
< |
} |
891 |
> |
} catch (NullPointerException success) {} |
892 |
|
} |
893 |
|
|
894 |
|
/** |
995 |
|
final LinkedTransferQueue q = new LinkedTransferQueue(); |
996 |
|
q.tryTransfer(null); |
997 |
|
shouldThrow(); |
998 |
< |
} catch (NullPointerException ex) { |
999 |
< |
} |
998 |
> |
} catch (NullPointerException success) {} |
999 |
|
} |
1000 |
|
|
1001 |
|
/** |