61 |
|
/** |
62 |
|
* Inserts the specified element into this delay queue. |
63 |
|
* |
64 |
< |
* @param o the element to add |
64 |
> |
* @param e the element to add |
65 |
|
* @return <tt>true</tt> |
66 |
|
* @throws NullPointerException if the specified element is <tt>null</tt>. |
67 |
|
*/ |
68 |
< |
public boolean offer(E o) { |
68 |
> |
public boolean offer(E e) { |
69 |
|
final ReentrantLock lock = this.lock; |
70 |
|
lock.lock(); |
71 |
|
try { |
72 |
|
E first = q.peek(); |
73 |
< |
q.offer(o); |
74 |
< |
if (first == null || o.compareTo(first) < 0) |
73 |
> |
q.offer(e); |
74 |
> |
if (first == null || e.compareTo(first) < 0) |
75 |
|
available.signalAll(); |
76 |
|
return true; |
77 |
|
} finally { |
83 |
|
/** |
84 |
|
* Adds the specified element to this delay queue. As the queue is |
85 |
|
* unbounded this method will never block. |
86 |
< |
* @param o the element to add |
86 |
> |
* @param e the element to add |
87 |
|
* @throws NullPointerException if the specified element is <tt>null</tt>. |
88 |
|
*/ |
89 |
< |
public void put(E o) { |
90 |
< |
offer(o); |
89 |
> |
public void put(E e) { |
90 |
> |
offer(e); |
91 |
|
} |
92 |
|
|
93 |
|
/** |
94 |
|
* Inserts the specified element into this delay queue. As the queue is |
95 |
|
* unbounded this method will never block. |
96 |
< |
* @param o the element to add |
96 |
> |
* @param e the element to add |
97 |
|
* @param timeout This parameter is ignored as the method never blocks |
98 |
|
* @param unit This parameter is ignored as the method never blocks |
99 |
|
* @return <tt>true</tt> |
100 |
|
* @throws NullPointerException if the specified element is <tt>null</tt>. |
101 |
|
*/ |
102 |
< |
public boolean offer(E o, long timeout, TimeUnit unit) { |
103 |
< |
return offer(o); |
102 |
> |
public boolean offer(E e, long timeout, TimeUnit unit) { |
103 |
> |
return offer(e); |
104 |
|
} |
105 |
|
|
106 |
|
/** |
107 |
|
* Adds the specified element to this queue. |
108 |
< |
* @param o the element to add |
108 |
> |
* @param e the element to add |
109 |
|
* @return <tt>true</tt> (as per the general contract of |
110 |
|
* <tt>Collection.add</tt>). |
111 |
|
* |
112 |
|
* @throws NullPointerException if the specified element is <tt>null</tt>. |
113 |
|
*/ |
114 |
< |
public boolean add(E o) { |
115 |
< |
return offer(o); |
114 |
> |
public boolean add(E e) { |
115 |
> |
return offer(e); |
116 |
|
} |
117 |
|
|
118 |
|
/** |