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

Comparing jsr166/src/main/java/util/concurrent/ThreadPoolExecutor.java (file contents):
Revision 1.12 by dl, Thu Aug 7 16:00:28 2003 UTC vs.
Revision 1.13 by dl, Fri Aug 8 17:48:45 2003 UTC

# Line 247 | Line 247 | public class ThreadPoolExecutor implemen
247          new AbortPolicy();
248  
249      /**
250 +     * Invoke the rejected execution handler for the give command.
251 +     */
252 +    void reject(Runnable command) {
253 +        handler.rejectedExecution(command, this);
254 +    }
255 +
256 +
257 +    /**
258       * Create and return a new thread running firstTask as its first
259       * task. Call only while holding mainLock
260       * @param firstTask the task the new thread should run first (or
# Line 271 | Line 279 | public class ThreadPoolExecutor implemen
279       * null if none)
280       * @return true if successful.
281       */
282 <    private boolean addIfUnderCorePoolSize(Runnable firstTask) {
282 >    // non-private; accessible to ScheduledExecutor
283 >    boolean addIfUnderCorePoolSize(Runnable firstTask) {
284          Thread t = null;
285          mainLock.lock();
286          try {
# Line 288 | Line 297 | public class ThreadPoolExecutor implemen
297      }
298  
299      /**
291     * Eagerly (vs by default lazily) start all core threads.
292     */
293    void prestartCoreThreads() {
294        while (addIfUnderCorePoolSize(null)) {
295        }
296    }
297
298
299    /**
300       * Create and start a new thread only if less than maximumPoolSize
301       * threads are running.  The new thread runs as its first task the
302       * next task in queue, or if there is none, the given task.
# Line 681 | Line 681 | public class ThreadPoolExecutor implemen
681      public void execute(Runnable command) {
682          for (;;) {
683              if (shutdownStatus != NOT_SHUTDOWN) {
684 <                handler.rejectedExecution(command, this);
684 >                reject(command);
685                  return;
686              }
687              if (poolSize < corePoolSize && addIfUnderCorePoolSize(command))
# Line 692 | Line 692 | public class ThreadPoolExecutor implemen
692              if (r == command)
693                  return;
694              if (r == null) {
695 <                handler.rejectedExecution(command, this);
695 >                reject(command);
696                  return;
697              }
698              // else retry

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines