12 |
|
import java.util.Collection; |
13 |
|
import java.util.Iterator; |
14 |
|
import java.util.NoSuchElementException; |
15 |
+ |
import java.util.Queue; |
16 |
|
import java.util.concurrent.BlockingQueue; |
17 |
|
import java.util.concurrent.CountDownLatch; |
18 |
|
import java.util.concurrent.Executors; |
19 |
|
import java.util.concurrent.ExecutorService; |
20 |
|
import java.util.concurrent.SynchronousQueue; |
21 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
21 |
– |
import java.io.*; |
22 |
|
|
23 |
|
public class SynchronousQueueTest extends JSR166TestCase { |
24 |
|
|
526 |
|
public void testSerialization() { testSerialization(false); } |
527 |
|
public void testSerialization_fair() { testSerialization(true); } |
528 |
|
public void testSerialization(boolean fair) { |
529 |
< |
final SynchronousQueue q = new SynchronousQueue(fair); |
530 |
< |
final SynchronousQueue r = serialClone(q); |
531 |
< |
assertTrue(q != r); |
532 |
< |
assertEquals(q.size(), r.size()); |
533 |
< |
while (!q.isEmpty()) |
534 |
< |
assertEquals(q.remove(), r.remove()); |
529 |
> |
final SynchronousQueue x = new SynchronousQueue(fair); |
530 |
> |
final SynchronousQueue y = serialClone(x); |
531 |
> |
assertTrue(x != y); |
532 |
> |
assertTrue(x.isEmpty()); |
533 |
> |
assertTrue(y.isEmpty()); |
534 |
|
} |
535 |
|
|
536 |
|
/** |