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.101 by jsr166, Sun Jan 21 20:18:07 2018 UTC vs.
Revision 1.102 by dl, Fri Mar 18 16:01:42 2022 UTC

# Line 360 | Line 360 | public class Executors {
360       * @throws AccessControlException if the current access control
361       * context does not have permission to both get and set context
362       * class loader
363 +     *
364 +     * @deprecated This method is only useful in conjunction with
365 +     *       {@linkplain SecurityManager the Security Manager}, which is
366 +     *       deprecated and subject to removal in a future release.
367 +     *       Consequently, this method is also deprecated and subject to
368 +     *       removal. There is no replacement for the Security Manager or this
369 +     *       method.
370       */
371 +    @Deprecated(since="17", forRemoval=true)
372      public static ThreadFactory privilegedThreadFactory() {
373          return new PrivilegedThreadFactory();
374      }
# Line 437 | Line 445 | public class Executors {
445       * @param <T> the type of the callable's result
446       * @return a callable object
447       * @throws NullPointerException if callable null
448 +     *
449 +     * @deprecated This method is only useful in conjunction with
450 +     *       {@linkplain SecurityManager the Security Manager}, which is
451 +     *       deprecated and subject to removal in a future release.
452 +     *       Consequently, this method is also deprecated and subject to
453 +     *       removal. There is no replacement for the Security Manager or this
454 +     *       method.
455       */
456 +    @Deprecated(since="17", forRemoval=true)
457      public static <T> Callable<T> privilegedCallable(Callable<T> callable) {
458          if (callable == null)
459              throw new NullPointerException();
# Line 463 | Line 479 | public class Executors {
479       * @throws AccessControlException if the current access control
480       * context does not have permission to both set and get context
481       * class loader
482 +     *
483 +     * @deprecated This method is only useful in conjunction with
484 +     *       {@linkplain SecurityManager the Security Manager}, which is
485 +     *       deprecated and subject to removal in a future release.
486 +     *       Consequently, this method is also deprecated and subject to
487 +     *       removal. There is no replacement for the Security Manager or this
488 +     *       method.
489       */
490 +    @Deprecated(since="17", forRemoval=true)
491      public static <T> Callable<T> privilegedCallableUsingCurrentClassLoader(Callable<T> callable) {
492          if (callable == null)
493              throw new NullPointerException();
# Line 496 | Line 520 | public class Executors {
520       */
521      private static final class PrivilegedCallable<T> implements Callable<T> {
522          final Callable<T> task;
523 +        @SuppressWarnings("removal")
524          final AccessControlContext acc;
525  
526 +        @SuppressWarnings("removal")
527          PrivilegedCallable(Callable<T> task) {
528              this.task = task;
529              this.acc = AccessController.getContext();
530          }
531  
532 +        @SuppressWarnings("removal")
533          public T call() throws Exception {
534              try {
535                  return AccessController.doPrivileged(
# Line 528 | Line 555 | public class Executors {
555      private static final class PrivilegedCallableUsingCurrentClassLoader<T>
556              implements Callable<T> {
557          final Callable<T> task;
558 +        @SuppressWarnings("removal")
559          final AccessControlContext acc;
560          final ClassLoader ccl;
561  
562 +        @SuppressWarnings("removal")
563          PrivilegedCallableUsingCurrentClassLoader(Callable<T> task) {
564              SecurityManager sm = System.getSecurityManager();
565              if (sm != null) {
# Line 548 | Line 577 | public class Executors {
577              this.ccl = Thread.currentThread().getContextClassLoader();
578          }
579  
580 +        @SuppressWarnings("removal")
581          public T call() throws Exception {
582              try {
583                  return AccessController.doPrivileged(
# Line 587 | Line 617 | public class Executors {
617          private final String namePrefix;
618  
619          DefaultThreadFactory() {
620 +            @SuppressWarnings("removal")
621              SecurityManager s = System.getSecurityManager();
622              group = (s != null) ? s.getThreadGroup() :
623                                    Thread.currentThread().getThreadGroup();
# Line 611 | Line 642 | public class Executors {
642       * Thread factory capturing access control context and class loader.
643       */
644      private static class PrivilegedThreadFactory extends DefaultThreadFactory {
645 +        @SuppressWarnings("removal")
646          final AccessControlContext acc;
647          final ClassLoader ccl;
648  
649 +        @SuppressWarnings("removal")
650          PrivilegedThreadFactory() {
651              super();
652              SecurityManager sm = System.getSecurityManager();
# Line 632 | Line 665 | public class Executors {
665  
666          public Thread newThread(final Runnable r) {
667              return super.newThread(new Runnable() {
668 +                @SuppressWarnings("removal")
669                  public void run() {
670                      AccessController.doPrivileged(new PrivilegedAction<>() {
671                          public Void run() {
# Line 728 | Line 762 | public class Executors {
762          FinalizableDelegatedExecutorService(ExecutorService executor) {
763              super(executor);
764          }
765 <        @SuppressWarnings("deprecation")
765 >        @SuppressWarnings({"deprecation", "removal"})
766          protected void finalize() {
767              super.shutdown();
768          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines