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 |
|
} |
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(); |
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(); |
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( |
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) { |
577 |
|
this.ccl = Thread.currentThread().getContextClassLoader(); |
578 |
|
} |
579 |
|
|
580 |
+ |
@SuppressWarnings("removal") |
581 |
|
public T call() throws Exception { |
582 |
|
try { |
583 |
|
return AccessController.doPrivileged( |
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(); |
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(); |
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() { |
762 |
|
FinalizableDelegatedExecutorService(ExecutorService executor) { |
763 |
|
super(executor); |
764 |
|
} |
765 |
< |
@SuppressWarnings("deprecation") |
765 |
> |
@SuppressWarnings({"deprecation", "removal"}) |
766 |
|
protected void finalize() { |
767 |
|
super.shutdown(); |
768 |
|
} |