17 |
|
implements BlockingQueue<E>, java.io.Serializable { |
18 |
|
|
19 |
|
private final PriorityQueue<E> q; |
20 |
< |
private final FairReentrantLock lock = new FairReentrantLock(); |
20 |
> |
// private final FairReentrantLock lock = new FairReentrantLock(); |
21 |
> |
private final ReentrantLock lock = new ReentrantLock(); |
22 |
|
private final Condition notEmpty = lock.newCondition(); |
23 |
|
|
24 |
|
/** |
73 |
|
q = new PriorityQueue<E>(initialElements); |
74 |
|
} |
75 |
|
|
76 |
+ |
/** |
77 |
+ |
* Returns the comparator associated with this priority queue, or |
78 |
+ |
* <tt>null</tt> if it uses its elements' natural ordering. |
79 |
+ |
* |
80 |
+ |
* @return the comparator associated with this priority queue, or |
81 |
+ |
* <tt>null</tt> if it uses its elements' natural ordering. |
82 |
+ |
*/ |
83 |
+ |
public Comparator comparator() { |
84 |
+ |
return q.comparator(); |
85 |
+ |
} |
86 |
+ |
|
87 |
|
public boolean offer(E x) { |
88 |
|
if (x == null) throw new NullPointerException(); |
89 |
|
lock.lock(); |