        final AccessControlContext acc;
        
        PrivilegedCallable(Callable<T> task) {
            this.task = task;
            this.acc = AccessController.getContext();
        }
        
        public T call() throws Exception {
            try {
                return AccessController.doPrivileged(new PrivilegedExceptionAction<T>() {
                    public T run() throws Exception {
                        return task.call();
                    }
                }, acc);
            } catch(PrivilegedActionException e) {
                throw e.getException();
            }
        }
        
        public String toString() {
            return super.toString() + "[Wrapped task = " + task + "]";
        }
    }
    
    /**
     * A callable that runs under established access control settings and
     * current ClassLoader.
     */
    // 包装Callable任务，使用上下文访问权限控制器和当前线程的类加载器
    private static final class PrivilegedCallableUsingCurrentClassLoader<T> implements Callable<T> {
        final Callable<T> task;
        final AccessControlContext acc;
        final ClassLoader ccl;
        
        PrivilegedCallableUsingCurrentClassLoader(Callable<T> task) {
            SecurityManager sm = System.getSecurityManager();
            if(sm != null) {
                // Calls to getContextClassLoader from this class
                // never trigger a security check, but we check
                // whether our callers have this permission anyways.
                sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
                
                // Whether setContextClassLoader turns out to be necessary
                // or not, we fail fast if permission is not available.
                sm.checkPermission(new RuntimePermission("setContextClassLoader"));
            }
            this.task = task;
            this.acc = AccessController.getContext();
            this.ccl = Thread.currentThread().getContextClassLoader();
        }
     