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.3 by dl, Thu May 29 13:49:24 2003 UTC vs.
Revision 1.4 by dl, Tue Jun 3 16:44:36 2003 UTC

# Line 41 | Line 41 | public class Executors {
41          public List shutdownNow() { return e.shutdownNow(); }
42          public boolean isShutdown() { return e.isShutdown(); }
43          public boolean isTerminated() { return e.isTerminated(); }
44 +        public boolean remove(Runnable r) { return e.remove(r) ; }
45          public boolean awaitTermination(long timeout, TimeUnit unit)
46              throws InterruptedException {
47              return e.awaitTermination(timeout, unit);
# Line 151 | Line 152 | public class Executors {
152      }
153  
154      /**
154     * Constructs a ScheduledExecutor.  A ScheduledExecutor is an
155     * Executor which can schedule tasks to run at a given future
156     * time, or to execute periodically.
157     *
158     * @param minThreads the minimum number of threads to keep in the
159     * pool, even if they are idle.
160     * @param maxThreads the maximum number of threads to allow in the
161     * pool.
162     * @param keepAliveTime when the number of threads is greater than
163     * the minimum, this is the maximum time that excess idle threads
164     * will wait for new tasks before terminating.
165     * @param unit the time unit for the keepAliveTime
166     * argument.
167     * @return the newly created ScheduledExecutor
168     */
169    //    public static ScheduledExecutor newScheduledExecutor(int minThreads,
170    //                                                         int maxThreads,
171    //                                                         long keepAliveTime,
172    //                                                         TimeUnit unit) {
173    //        return new ScheduledExecutor(minThreads, maxThreads,
174    //                                     keepAliveTime, unit);
175    //    }
176
177    /**
155       * Executes a Runnable task and returns a Future representing that
156       * task.
157       *
# Line 182 | Line 159 | public class Executors {
159       * @param task the task to submit
160       * @param value the value which will become the return value of
161       * the task upon task completion
162 <     * @return a Future representing pending completion of the task
162 >     * @return a CancellableTask that allows cancellation.
163       * @throws CannotExecuteException if the task cannot be scheduled
164       * for execution
165       */
166 <    public static <T> Future<T> execute(Executor executor, Runnable task, T value) {
167 <        FutureTask<T> ftask = new FutureTask<T>(task, value);
166 >    public static CancellableTask execute(Executor executor, Runnable task) {
167 >        CancellableTask ftask = new CancellableTask(task);
168          executor.execute(ftask);
169          return ftask;
170      }
# Line 201 | Line 178 | public class Executors {
178       * @return a Future representing pending completion of the task
179       * @throws CannotExecuteException if task cannot be scheduled for execution
180       */
181 <    public static <T> Future<T> execute(Executor executor, Callable<T> task) {
181 >    public static <T> FutureTask<T> execute(Executor executor, Callable<T> task) {
182          FutureTask<T> ftask = new FutureTask<T>(task);
183          executor.execute(ftask);
184          return ftask;
# Line 217 | Line 194 | public class Executors {
194       */
195      public static void invoke(Executor executor, Runnable task)
196              throws ExecutionException, InterruptedException {
197 <        FutureTask ftask = new FutureTask(task, Boolean.TRUE);
197 >        FutureTask<Boolean> ftask = new FutureTask(task, Boolean.TRUE);
198          executor.execute(ftask);
199          ftask.get();
200      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines