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.54 by jsr166, Wed May 18 01:44:45 2005 UTC vs.
Revision 1.55 by dl, Wed May 25 14:05:27 2005 UTC

# Line 337 | Line 337 | public class Executors {
337       * @return a callable object
338       * @throws NullPointerException if action null
339       */
340 <    public static Callable<Object> callable(PrivilegedAction action) {
340 >    public static Callable<Object> callable(PrivilegedAction<?> action) {
341          if (action == null)
342              throw new NullPointerException();
343 <        return new PrivilegedActionAdapter(action);
343 >        return new PrivilegedActionAdapter<Object>(action);
344      }
345  
346      /**
# Line 351 | Line 351 | public class Executors {
351       * @return a callable object
352       * @throws NullPointerException if action null
353       */
354 <    public static Callable<Object> callable(PrivilegedExceptionAction action) {
354 >    public static Callable<Object> callable(PrivilegedExceptionAction<?> action) {
355          if (action == null)
356              throw new NullPointerException();
357 <        return new PrivilegedExceptionActionAdapter(action);
357 >        return new PrivilegedExceptionActionAdapter<Object>(action);
358      }
359  
360      /**
# Line 374 | Line 374 | public class Executors {
374      public static <T> Callable<T> privilegedCallable(Callable<T> callable) {
375          if (callable == null)
376              throw new NullPointerException();
377 <        return new PrivilegedCallable(callable);
377 >        return new PrivilegedCallable<T>(callable);
378      }
379  
380      /**
# Line 398 | Line 398 | public class Executors {
398      public static <T> Callable<T> privilegedCallableUsingCurrentClassLoader(Callable<T> callable) {
399          if (callable == null)
400              throw new NullPointerException();
401 <        return new PrivilegedCallableUsingCurrentClassLoader(callable);
401 >        return new PrivilegedCallableUsingCurrentClassLoader<T>(callable);
402      }
403  
404      // Non-public classes supporting the public methods
# Line 422 | Line 422 | public class Executors {
422      /**
423       * A callable that runs given privileged action and returns its result
424       */
425 <    static final class PrivilegedActionAdapter implements Callable<Object> {
425 >    static final class PrivilegedActionAdapter<T> implements Callable<Object> {
426          PrivilegedActionAdapter(PrivilegedAction action) {
427              this.action = action;
428          }
# Line 435 | Line 435 | public class Executors {
435      /**
436       * A callable that runs given privileged exception action and returns its result
437       */
438 <    static final class PrivilegedExceptionActionAdapter implements Callable<Object> {
438 >    static final class PrivilegedExceptionActionAdapter<T> implements Callable<Object> {
439          PrivilegedExceptionActionAdapter(PrivilegedExceptionAction action) {
440              this.action = action;
441          }
# Line 460 | Line 460 | public class Executors {
460          }
461  
462          public T call() throws Exception {
463 <            AccessController.doPrivileged(new PrivilegedAction() {
464 <                    public Object run() {
463 >            AccessController.doPrivileged(new PrivilegedAction<T>() {
464 >                    public T run() {
465                          try {
466                              result = task.call();
467                          } catch (Exception ex) {
# Line 496 | Line 496 | public class Executors {
496          }
497  
498          public T call() throws Exception {
499 <            AccessController.doPrivileged(new PrivilegedAction() {
500 <                    public Object run() {
499 >            AccessController.doPrivileged(new PrivilegedAction<T>() {
500 >                    public T run() {
501                          ClassLoader savedcl = null;
502                          Thread t = Thread.currentThread();
503                          try {
# Line 570 | Line 570 | public class Executors {
570          public Thread newThread(final Runnable r) {
571              return super.newThread(new Runnable() {
572                  public void run() {
573 <                    AccessController.doPrivileged(new PrivilegedAction() {
573 >                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
574                          public Object run() {
575                              Thread.currentThread().setContextClassLoader(ccl);
576                              r.run();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines