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

Comparing jsr166/src/main/java/util/concurrent/AbstractExecutorService.java (file contents):
Revision 1.7 by dl, Tue Dec 16 12:45:06 2003 UTC vs.
Revision 1.8 by dl, Tue Dec 16 12:58:20 2003 UTC

# Line 146 | Line 146 | public abstract class AbstractExecutorSe
146              long lastTime = System.nanoTime();
147              while (n-- > 0) {
148                  Future<T> f = ecs.poll(nanos, TimeUnit.NANOSECONDS);
149 <                if (f == null) {
150 <                    if (nanos <= 0)
151 <                        throw new TimeoutException();
152 <                    long now = System.nanoTime();
153 <                    nanos -= now - lastTime;
154 <                    lastTime = now;
155 <                }
149 >                if (f == null)
150 >                    throw new TimeoutException();
151                  try {
152                      return f.get();
153                  } catch(ExecutionException eex) {
# Line 160 | Line 155 | public abstract class AbstractExecutorSe
155                  } catch(RuntimeException rex) {
156                      re = rex;
157                  }
158 +                long now = System.nanoTime();
159 +                nanos -= now - lastTime;
160 +                lastTime = now;
161              }    
162              if (ee != null)
163                  throw ee;
# Line 229 | Line 227 | public abstract class AbstractExecutorSe
227              long lastTime = System.nanoTime();
228              while (n-- > 0) {
229                  Future<T> f = ecs.poll(nanos, TimeUnit.NANOSECONDS);
230 <                if (f == null) {
231 <                    if (nanos <= 0)
234 <                        throw new TimeoutException();
235 <                    long now = System.nanoTime();
236 <                    nanos -= now - lastTime;
237 <                    lastTime = now;
238 <                }
230 >                if (f == null)
231 >                    throw new TimeoutException();
232                  try {
233                      return f.get();
234                  } catch(ExecutionException eex) {
# Line 243 | Line 236 | public abstract class AbstractExecutorSe
236                  } catch(RuntimeException rex) {
237                      re = rex;
238                  }
239 +                long now = System.nanoTime();
240 +                nanos -= now - lastTime;
241 +                lastTime = now;
242              }    
243              if (ee != null)
244                  throw ee;
# Line 307 | Line 303 | public abstract class AbstractExecutorSe
303                          return futures;
304                      try {
305                          f.get(nanos, TimeUnit.NANOSECONDS);
310                        long now = System.nanoTime();
311                        nanos -= now - lastTime;
312                        lastTime = now;
306                      } catch(CancellationException ignore) {
307                      } catch(ExecutionException ignore) {
308                      } catch(TimeoutException toe) {
309                          return futures;
310                      }
311 +                    long now = System.nanoTime();
312 +                    nanos -= now - lastTime;
313 +                    lastTime = now;
314                  }
315              }
316              done = true;
# Line 377 | Line 373 | public abstract class AbstractExecutorSe
373                          return futures;
374                      try {
375                          f.get(nanos, TimeUnit.NANOSECONDS);
380                        long now = System.nanoTime();
381                        nanos -= now - lastTime;
382                        lastTime = now;
376                      } catch(CancellationException ignore) {
377                      } catch(ExecutionException ignore) {
378                      } catch(TimeoutException toe) {
379                          return futures;
380                      }
381 +                    long now = System.nanoTime();
382 +                    nanos -= now - lastTime;
383 +                    lastTime = now;
384                  }
385              }
386              done = true;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines