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

Comparing jsr166/src/main/java/util/concurrent/Executors.java (file contents):
Revision 1.65 by dl, Thu Mar 23 00:34:21 2006 UTC vs.
Revision 1.66 by dl, Thu Mar 23 16:57:56 2006 UTC

# Line 97 | Line 97 | public class Executors {
97       * @return the newly created single-threaded Executor
98       */
99      public static ExecutorService newSingleThreadExecutor() {
100 <        return new DelegatedExecutorService
100 >        return new FinalizableDelegatedExecutorService
101              (new ThreadPoolExecutor(1, 1,
102                                      0L, TimeUnit.MILLISECONDS,
103                                      new LinkedBlockingQueue<Runnable>()));
# Line 117 | Line 117 | public class Executors {
117       * @return the newly created single-threaded Executor
118       */
119      public static ExecutorService newSingleThreadExecutor(ThreadFactory threadFactory) {
120 <        return new DelegatedExecutorService
120 >        return new FinalizableDelegatedExecutorService
121              (new ThreadPoolExecutor(1, 1,
122                                      0L, TimeUnit.MILLISECONDS,
123                                      new LinkedBlockingQueue<Runnable>(),
# Line 613 | Line 613 | public class Executors {
613              throws InterruptedException, ExecutionException, TimeoutException {
614              return e.invokeAny(tasks, timeout, unit);
615          }
616 +    }
617 +
618 +    static class FinalizableDelegatedExecutorService
619 +        extends DelegatedExecutorService {
620 +        FinalizableDelegatedExecutorService(ExecutorService executor) {
621 +            super(executor);
622 +        }
623          protected void finalize()  {
624 <            e.shutdown();
624 >            super.shutdown();
625          }
619
626      }
627 +        
628  
629      /**
630       * A wrapper class that exposes only the ScheduledExecutorService

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines