ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/DelayQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/DelayQueue.java (file contents):
Revision 1.12 by dl, Thu Aug 7 16:00:28 2003 UTC vs.
Revision 1.13 by tim, Fri Aug 8 20:05:07 2003 UTC

# Line 58 | Line 58 | public class DelayQueue<E extends Delaye
58              if (first == null || o.compareTo(first) < 0)
59                  available.signalAll();
60              return true;
61 <        }
62 <        finally {
61 >        } finally {
62              lock.unlock();
63          }
64      }
# Line 105 | Line 104 | public class DelayQueue<E extends Delaye
104                  E first = q.peek();
105                  if (first == null) {
106                      available.await();
107 <                }
109 <                else {
107 >                } else {
108                      long delay =  first.getDelay(TimeUnit.NANOSECONDS);
109                      if (delay > 0) {
110                          long tl = available.awaitNanos(delay);
111 <                    }
114 <                    else {
111 >                    } else {
112                          E x = q.poll();
113                          assert x != null;
114                          if (q.size() != 0)
# Line 121 | Line 118 | public class DelayQueue<E extends Delaye
118                      }
119                  }
120              }
121 <        }
125 <        finally {
121 >        } finally {
122              lock.unlock();
123          }
124      }
# Line 138 | Line 134 | public class DelayQueue<E extends Delaye
134                          return null;
135                      else
136                          nanos = available.awaitNanos(nanos);
137 <                }
142 <                else {
137 >                } else {
138                      long delay =  first.getDelay(TimeUnit.NANOSECONDS);
139                      if (delay > 0) {
140                          if (delay > nanos)
141                              delay = nanos;
142                          long timeLeft = available.awaitNanos(delay);
143                          nanos -= delay - timeLeft;
144 <                    }
150 <                    else {
144 >                    } else {
145                          E x = q.poll();
146                          assert x != null;
147                          if (q.size() != 0)
# Line 156 | Line 150 | public class DelayQueue<E extends Delaye
150                      }
151                  }
152              }
153 <        }
160 <        finally {
153 >        } finally {
154              lock.unlock();
155          }
156      }
# Line 176 | Line 169 | public class DelayQueue<E extends Delaye
169                      available.signalAll();
170                  return x;
171              }
172 <        }
180 <        finally {
172 >        } finally {
173              lock.unlock();
174          }
175      }
# Line 186 | Line 178 | public class DelayQueue<E extends Delaye
178          lock.lock();
179          try {
180              return q.peek();
181 <        }
190 <        finally {
181 >        } finally {
182              lock.unlock();
183          }
184      }
# Line 196 | Line 187 | public class DelayQueue<E extends Delaye
187          lock.lock();
188          try {
189              return q.size();
190 <        }
200 <        finally {
190 >        } finally {
191              lock.unlock();
192          }
193      }
# Line 210 | Line 200 | public class DelayQueue<E extends Delaye
200          lock.lock();
201          try {
202              q.clear();
203 <        }
214 <        finally {
203 >        } finally {
204              lock.unlock();
205          }
206      }
# Line 229 | Line 218 | public class DelayQueue<E extends Delaye
218          lock.lock();
219          try {
220              return q.toArray();
221 <        }
233 <        finally {
221 >        } finally {
222              lock.unlock();
223          }
224      }
# Line 239 | Line 227 | public class DelayQueue<E extends Delaye
227          lock.lock();
228          try {
229              return q.toArray(array);
230 <        }
243 <        finally {
230 >        } finally {
231              lock.unlock();
232          }
233      }
# Line 263 | Line 250 | public class DelayQueue<E extends Delaye
250          lock.lock();
251          try {
252              return q.remove(o);
253 <        }
267 <        finally {
253 >        } finally {
254              lock.unlock();
255          }
256      }
# Line 282 | Line 268 | public class DelayQueue<E extends Delaye
268          lock.lock();
269          try {
270              return new Itr(q.iterator());
271 <        }
286 <        finally {
271 >        } finally {
272              lock.unlock();
273          }
274      }
# Line 302 | Line 287 | public class DelayQueue<E extends Delaye
287              lock.lock();
288              try {
289                  return iter.next();
290 <            }
306 <            finally {
290 >            } finally {
291                  lock.unlock();
292              }
293          }
# Line 312 | Line 296 | public class DelayQueue<E extends Delaye
296              lock.lock();
297              try {
298                  iter.remove();
299 <            }
316 <            finally {
299 >            } finally {
300                  lock.unlock();
301              }
302          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines