Priority() != Thread.NORM_PRIORITY) {
                t.setPriority(Thread.NORM_PRIORITY);
            }
            
            return t;
        }
    }
    
    /**
     * Thread factory capturing access control context and class loader.
     */
    // 特权线程工厂
    private static class PrivilegedThreadFactory extends DefaultThreadFactory {
        final AccessControlContext acc;
        final ClassLoader ccl;
        
        PrivilegedThreadFactory() {
            super();
    
            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);
    
                // Fail fast
                sm.checkPermission(new RuntimePermission("setContextClassLoader"));
            }
    
            this.acc = AccessController.getContext();
            this.ccl = Thread.currentThread().getContextClassLoader();
        }
        
        public Thread newThread(final Runnable r) {
            return super.newThread(new Runnable() {
                public void run() {
                    AccessController.doPrivileged(new PrivilegedAction<>() {
                        public Void run() {
                            Thread.currentThread().setContextClassLoader(ccl);
                            r.run();
                            return null;
                        }
                    }, acc);
                }
            });
        }
    }
}


files
{
    0    1 1 test_job test_namespace strings1.xml 0
    1    2 6 test_job test_namespace strings2.xml 0
    2    3 13 test_job test_namespace strings3.xml 0
    3    4 20 test_job test_namespace strings4.xml 0
    4    5 28 test_job test_namespace strings5.xml 0
}


# deprecated


/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE 