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

Comparing jsr166/src/main/java/util/concurrent/ScheduledThreadPoolExecutor.java (file contents):
Revision 1.105 by jsr166, Tue Mar 28 00:02:18 2017 UTC vs.
Revision 1.106 by jsr166, Tue Mar 28 00:41:44 2017 UTC

# Line 15 | Line 15 | import java.util.Collection;
15   import java.util.Iterator;
16   import java.util.List;
17   import java.util.NoSuchElementException;
18 + import java.util.Objects;
19   import java.util.concurrent.atomic.AtomicLong;
20   import java.util.concurrent.locks.Condition;
21   import java.util.concurrent.locks.ReentrantLock;
# Line 1183 | Line 1184 | public class ScheduledThreadPoolExecutor
1184          }
1185  
1186          public int drainTo(Collection<? super Runnable> c, int maxElements) {
1187 <            if (c == null)
1187 <                throw new NullPointerException();
1187 >            Objects.requireNonNull(c);
1188              if (c == this)
1189                  throw new IllegalArgumentException();
1190              if (maxElements <= 0)
# Line 1192 | Line 1192 | public class ScheduledThreadPoolExecutor
1192              final ReentrantLock lock = this.lock;
1193              lock.lock();
1194              try {
1195                RunnableScheduledFuture<?> first;
1195                  int n = 0;
1196 <                while (n < maxElements
1197 <                       && (first = queue[0]) != null
1198 <                       && first.getDelay(NANOSECONDS) <= 0) {
1196 >                for (RunnableScheduledFuture<?> first;
1197 >                     n < maxElements
1198 >                         && (first = queue[0]) != null
1199 >                         && first.getDelay(NANOSECONDS) <= 0;) {
1200                      c.add(first);   // In this order, in case add() throws.
1201                      finishPoll(first);
1202                      ++n;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines