jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java
changeset 3708 f838f712922e
parent 3414 cdf768813b4d
child 4110 ac033ba6ede4
equal deleted inserted replaced
3707:67e8505ef721 3708:f838f712922e
    39  */
    39  */
    40 
    40 
    41 import java.util.concurrent.ArrayBlockingQueue;
    41 import java.util.concurrent.ArrayBlockingQueue;
    42 import java.util.concurrent.ConcurrentHashMap;
    42 import java.util.concurrent.ConcurrentHashMap;
    43 import java.util.concurrent.ConcurrentLinkedQueue;
    43 import java.util.concurrent.ConcurrentLinkedQueue;
       
    44 import java.util.concurrent.LinkedBlockingDeque;
    44 import java.util.concurrent.LinkedBlockingQueue;
    45 import java.util.concurrent.LinkedBlockingQueue;
    45 import java.util.concurrent.LinkedBlockingDeque;
    46 // import java.util.concurrent.LinkedTransferQueue;
    46 import java.util.concurrent.PriorityBlockingQueue;
    47 import java.util.concurrent.PriorityBlockingQueue;
    47 import java.util.LinkedList;
    48 import java.util.LinkedList;
    48 import java.util.PriorityQueue;
    49 import java.util.PriorityQueue;
    49 import java.util.ArrayList;
    50 import java.util.ArrayList;
    50 import java.util.Collection;
    51 import java.util.Collection;
    67         queues.add(new LinkedBlockingQueue<Boolean>());
    68         queues.add(new LinkedBlockingQueue<Boolean>());
    68         queues.add(new LinkedBlockingDeque<Boolean>());
    69         queues.add(new LinkedBlockingDeque<Boolean>());
    69         queues.add(new PriorityBlockingQueue<Boolean>());
    70         queues.add(new PriorityBlockingQueue<Boolean>());
    70         queues.add(new PriorityQueue<Boolean>());
    71         queues.add(new PriorityQueue<Boolean>());
    71         queues.add(new LinkedList<Boolean>());
    72         queues.add(new LinkedList<Boolean>());
    72 
    73 //         queues.add(new LinkedTransferQueue<Boolean>());
    73         try {
       
    74             queues.add((Queue<Boolean>)
       
    75                        Class.forName("java.util.concurrent.LinkedTransferQueue")
       
    76                        .newInstance());
       
    77         } catch (IllegalAccessException e) {
       
    78         } catch (InstantiationException e) {
       
    79         } catch (ClassNotFoundException e) {
       
    80             // OK; not yet added to JDK
       
    81         }
       
    82 
    74 
    83         // Following additional implementations are available from:
    75         // Following additional implementations are available from:
    84         // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html
    76         // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html
    85         // queues.add(new LinkedTransferQueue<Boolean>());
       
    86         // queues.add(new SynchronizedLinkedListQueue<Boolean>());
    77         // queues.add(new SynchronizedLinkedListQueue<Boolean>());
    87 
    78 
    88         // Avoid "first fast, second slow" benchmark effect.
    79         // Avoid "first fast, second slow" benchmark effect.
    89         Collections.shuffle(queues);
    80         Collections.shuffle(queues);
    90         return queues;
    81         return queues;