Print this page


Split Close
Expand all
Collapse all
          --- old/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java
          +++ new/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java
↓ open down ↓ 45 lines elided ↑ open up ↑
  46   46      void test(String[] args) throws Throwable {
  47   47          test(new LinkedBlockingQueue());
  48   48          test(new LinkedBlockingQueue(20));
  49   49          test(new LinkedBlockingDeque());
  50   50          test(new LinkedBlockingDeque(20));
  51   51          test(new ConcurrentLinkedDeque());
  52   52          test(new ConcurrentLinkedQueue());
  53   53          test(new LinkedTransferQueue());
  54   54          // Other concurrent queues (e.g. ArrayBlockingQueue) do not
  55   55          // currently have weakly consistent iterators.
  56      -        // test(new ArrayBlockingQueue(20));
       56 +        // As of 2010-09, ArrayBlockingQueue passes this test, but
       57 +        // does not fully implement weak consistency.
       58 +        test(new ArrayBlockingQueue(20));
  57   59      }
  58   60  
  59   61      void test(Queue q) {
  60   62          // TODO: make this more general
  61   63          try {
  62   64              for (int i = 0; i < 10; i++)
  63   65                  q.add(i);
  64   66              Iterator it = q.iterator();
  65   67              q.poll();
  66   68              q.poll();
↓ open down ↓ 49 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX