< prev index next >

src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java

Print this page

1533                                           (ObjectName)params[1],
1534                                           (NotificationFilter)params[2],
1535                                           params[3]);
1536             return null;
1537 
1538         default:
1539             throw new IllegalArgumentException("Invalid operation");
1540         }
1541     }
1542 
1543     private static class SetCcl implements PrivilegedExceptionAction<ClassLoader> {
1544         private final ClassLoader classLoader;
1545 
1546         SetCcl(ClassLoader classLoader) {
1547             this.classLoader = classLoader;
1548         }
1549 
1550         public ClassLoader run() {
1551             Thread currentThread = Thread.currentThread();
1552             ClassLoader old = currentThread.getContextClassLoader();
1553             currentThread.setContextClassLoader(classLoader);


1554             return old;
1555         }
1556     }
1557 
1558     @SuppressWarnings("removal")
1559     private <T> T unwrap(final MarshalledObject<?> mo,
1560                                 final ClassLoader cl,
1561                                 final Class<T> wrappedClass,
1562                                 Subject delegationSubject)
1563             throws IOException {
1564         if (mo == null) {
1565             return null;
1566         }
1567         try {
1568             final ClassLoader old = AccessController.doPrivileged(new SetCcl(cl));
1569             try{
1570                 final AccessControlContext reqACC;
1571                 if (delegationSubject == null)
1572                     reqACC = acc;
1573                 else {

1533                                           (ObjectName)params[1],
1534                                           (NotificationFilter)params[2],
1535                                           params[3]);
1536             return null;
1537 
1538         default:
1539             throw new IllegalArgumentException("Invalid operation");
1540         }
1541     }
1542 
1543     private static class SetCcl implements PrivilegedExceptionAction<ClassLoader> {
1544         private final ClassLoader classLoader;
1545 
1546         SetCcl(ClassLoader classLoader) {
1547             this.classLoader = classLoader;
1548         }
1549 
1550         public ClassLoader run() {
1551             Thread currentThread = Thread.currentThread();
1552             ClassLoader old = currentThread.getContextClassLoader();
1553             if (classLoader != old) {
1554                 currentThread.setContextClassLoader(classLoader);
1555             }
1556             return old;
1557         }
1558     }
1559 
1560     @SuppressWarnings("removal")
1561     private <T> T unwrap(final MarshalledObject<?> mo,
1562                                 final ClassLoader cl,
1563                                 final Class<T> wrappedClass,
1564                                 Subject delegationSubject)
1565             throws IOException {
1566         if (mo == null) {
1567             return null;
1568         }
1569         try {
1570             final ClassLoader old = AccessController.doPrivileged(new SetCcl(cl));
1571             try{
1572                 final AccessControlContext reqACC;
1573                 if (delegationSubject == null)
1574                     reqACC = acc;
1575                 else {
< prev index next >